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

Geting event on selection in hierarcial Grid

I created a grid with two heirarchy levels. I want to be notified of row selection. I could not find and event that is activated on selection of rows that are not in the root level. Is there any thing to do ? Asaf

6 Replies

AD Administrator Syncfusion Team September 2, 2003 04:21 AM

You can use the grid.RowEnter event which should be fired anytime the current row changes (whether it is to a different level of not). In it, you can use the e.RowIndex to get the GridBoundRecordState for the row. From the GridBoundRecordState, you can get its level (as well as other properties of interest). Dim rs As GridBoundRecordState = Me.gridDataBoundGrid1.Binder.GetRecordStateAtRowIndex(e.RowIndex) Dim level As Integer = rs.LevelIndex


AS Asaf Segal September 3, 2003 08:43 PM

In my test it worked only for the root level, did I do something wrong ?


AD Administrator Syncfusion Team September 4, 2003 02:57 AM

It seems to work in the attached sample. Now, the grid only knows data when the parent node is expanded. So, you cannot get information from the grid on any row that is not expanded. But the above code should worked for any row that you can see in the grid.


AD Administrator Syncfusion Team September 4, 2003 02:58 AM

Forgot to attached the sample.


AS Asaf Segal September 4, 2003 05:32 AM

Thanks for the sample, but it is not what I really need. The attached sample is not registered to grid.RowEnter. What I need is to get the row enter event when I click on a row the is not in the root level.


AD Administrator Syncfusion Team September 4, 2003 10:22 AM

In the sample, adding this rowenter event identified parent level and child levels for me.
private void gridDataBoundGrid1_RowEnter(object sender, GridRowEventArgs e)
{
	GridBoundRecordState rs = this.gridDataBoundGrid1.Binder.GetRecordStateAtRowIndex(e.RowIndex);
	if(rs.LevelIndex > 0)
		Console.WriteLine("child level");
	else
		Console.WriteLine("root level");
}

Loader.
Live Chat Icon For mobile
Up arrow icon