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

MouseDown event and absolute column/row

Hi, I'm trying to figure out how to get the absolute Row/Column in the Grid.MouseDown event. I can get the visible Row/Column, but I NEED the absolute Row/Column. Is there a way to get this information without going into the CellMouseDown event? The problem I have with using the CellMouseDownEvent, is that I do not want the user to actually get into the cell, but it's too late at that time, as the cell is being changed to the Edit mode. Maybe I'm not using the right events to deal with that issue! Please help!

1 Reply

AD Administrator Syncfusion Team November 12, 2003 05:53 PM UTC

You can get the row and col with code like this.
private void gridControl1_MouseDown(object sender, MouseEventArgs e)
	int row, col;
	if(this.gridControl1.PointToRowCol(new Point(e.X, e.Y), out row, out col, -1))
		Console.WriteLine(row.ToString() + "  " + col.ToString())
But if you want to prevent the currentcell from moving with a click, you might try setting e.Cancel = true in CurrentCellMoving.
private void gridControl1_CurrentCellMoving(object sender, 
	GridCurrentCellMovingEventArgs e)
	if(e.ColIndex == 3)
		e.Cancel = true;

Live Chat Icon For mobile
Up arrow icon