We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.


Thread ID:





22593 Dec 16,2004 02:30 AM Dec 17,2004 04:18 AM Windows Forms 3
Tags: GridControl
Administrator [Syncfusion]
Asked On December 16, 2004 02:30 AM

Hi, I have a column whose enabled property is set to false. Say that is column 2. I perform the following steps: 1. I click in row 1 column 3. 2. I click in row 2 column 2 ( whose enabled property is set to false ) Then the cell in row 1 remains as the current cell. What i want is that when i click on the cell whose enabled property is set to false then that entire row should be selected without having any cell as the current cell.

Administrator [Syncfusion]
Replied On December 16, 2004 04:55 AM

I think you can do this using MouseDown and MouseUp event handlers. Here is some code that worked for me using
private int mouseDownRow = -1;
private int mouseDownCol = -1;
private void gridDataBoundGrid1_MouseDown(object sender, MouseEventArgs e)
	Point pt = new Point(e.X, e.Y);;
	this.gridDataBoundGrid1.PointToRowCol(pt, out mouseDownRow, out mouseDownCol);
private void gridDataBoundGrid1_MouseUp(object sender, MouseEventArgs e)
	Point pt = new Point(e.X, e.Y);
	int row, col;
	if(this.gridDataBoundGrid1.PointToRowCol(pt, out row, out col)
		&& row == mouseDownRow && col == mouseDownCol)
		if(!this.gridDataBoundGrid1[row, col].Enabled)
			this.gridDataBoundGrid1.CurrentCell.MoveTo(-1, -1);
			this.gridDataBoundGrid1.Binder.CurrentPosition = this.gridDataBoundGrid1.Binder.RowIndexToPosition(row);
	mouseDownRow = -1;
	mouseDownCol = -1;

Administrator [Syncfusion]
Replied On December 16, 2004 08:54 PM

Hi, I am working with gridcontrol and not the databound grid. The gridcontrol does not have binder property. Then how do i implement this.gridDataBoundGrid1.Binder.CurrentPosition = this.gridDataBoundGrid1.Binder.RowIndexToPosition(row);

Administrator [Syncfusion]
Replied On December 17, 2004 04:18 AM

That line is to synchronize the CurrencyManager for teh datasource. So, you would not need to do this for a GridControl. Here is a sample.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.