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. Image for the cookie policy date

selection

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.

3 Replies

AD Administrator Syncfusion Team December 16, 2004 09:55 AM UTC

I think you can do this using MouseDown and MouseUp event handlers. Here is some code that worked for me using 2.1.0.9.
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;
}


AD Administrator Syncfusion Team December 17, 2004 01:54 AM UTC

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);


AD Administrator Syncfusion Team December 17, 2004 09:18 AM UTC

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. http://64.78.18.34/support/user/uploads/WindowsApplication14Forum.zip

Loader.
Live Chat Icon For mobile
Up arrow icon