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

How to get the row that the mouse is currently on

Hi,
Probably an easy one but can't find an example, how can I get the row in a GGC that the mouse is currently on top of?

Thanks
John

1 Reply

AD Administrator Syncfusion Team January 31, 2007 12:30 AM UTC

Here is a snippet that shows 2 ways to do this.

void gridGroupingControl1_TableControlMouseDown(object sender, GridTableControlMouseEventArgs e)
{
Point pt = new Point(e.Inner.X, e.Inner.Y);
Element el = e.TableControl.PointToNestedDisplayElement(pt);
if (el is GridRecordRow)
{
GridRecordRow grr = el as GridRecordRow;
Console.WriteLine( grr.GetRecord().GetValue("Col1")); //some field
}

int row, col;
if (e.TableControl.PointToRowCol(pt, out row, out col))
{
GridTableCellStyleInfo style = e.TableControl.GetTableViewStyleInfo(row, col);
GridRecordRow grr = style.TableCellIdentity.DisplayElement as GridRecordRow;
if (grr != null)
{
Console.WriteLine(grr.GetRecord().GetValue(style.TableCellIdentity.Column.Name)); //clicked field
}
}
}

Loader.
Live Chat Icon For mobile
Up arrow icon