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

Finding out current row in grid

I am using your newest grid (3....). I have created an event handler for the grid.ContextMenu.Popup event. Based on the row the user is in, we are trying to determine which items on the menu we''d like to make available to the user. While in this event handler, is there any way to determine the row that has been clicked when the mouse has been right clicked to bring up the popup menu? More specifically, I need to know: 1- Have I clicked on a summary/group by row? 2- If the anwser to the above question is yes, what level in my grouping scheme (first group by column, second group by column, etc..) am I in when I brought up the menu? thanks

1 Reply

AD Administrator Syncfusion Team January 10, 2005 11:38 PM UTC

You can handle the TableControlMouseDown event and track the GridTableCellStyleInfo for the clicked cell. Then in your menuhandler, you can access the TableCellIdentity for this saved style. This object has complete information for the clicked record which you can access through the DisplayElement.
GridTableCellStyleInfo mouseDownCellStyle = null;
private void gridGroupingControl1_TableControlMouseDown(object sender, GridTableControlMouseEventArgs e)
{
	int row, col;
	if(e.TableControl.PointToRowCol(new Point(e.Inner.X, e.Inner.Y), out row, out col))
	{
		mouseDownCellStyle = e.TableControl.Model[row, col];
	}
	else
		mouseDownCellStyle = null;
}

private void menuItem1_Click(object sender, System.EventArgs e)
{
	Console.WriteLine(this.mouseDownCellStyle.TableCellIdentity.Info);
	//this.mouseDownCellStyle.TableCellIdentity.DisplayElement
}

Loader.
Live Chat Icon For mobile
Up arrow icon