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

GGC TableControlMouseDown Table Level

Is there a way to check the level of the record (child or parent) in TableControlMouseDown event handler without checking TableCellIdentity.Table.TableDescriptor.Name? Thank you.

2 Replies

AD Administrator Syncfusion Team December 5, 2005 06:26 PM UTC

You can use code like:
private void gridGroupingControl1_TableControlMouseDown(object sender, GridTableControlMouseEventArgs e)
{
	Element el = this.gridGroupingControl1.TableControl.PointToNestedDisplayElement(new Point(e.Inner.X, e.Inner.Y));
	Console.WriteLine(GetLevelFromTableControl(el.ParentTableDescriptor.Name));
}
private int GetLevelFromTableControl(string name)
{
	int i = 0;
	GridTableDescriptor td = this.gridGroupingControl1.TableDescriptor;
	while(td != null && td.Name != name)
	{
		i++;
		if(td.Relations != null && td.Relations.Count > 0)
			td = td.Relations[0].ChildTableDescriptor;
		else
			td = null;
	}
	return i;
}

            


AD Administrator Syncfusion Team December 5, 2005 06:35 PM UTC

Thank you! This works perfectly

Loader.
Live Chat Icon For mobile
Up arrow icon