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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to get the row that the mouse is currently on

Thread ID:

Created:

Updated:

Platform:

Replies:

55451 Jan 30,2007 03:53 PM UTC Jan 31,2007 12:30 AM UTC WinForms 1
loading
Tags: GridControl
John H
Asked On January 30, 2007 03:53 PM UTC

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

Administrator [Syncfusion]
Replied On 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
}
}
}

CONFIRMATION

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.

Warning Icon 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.Close Icon

;