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 08:21 AM UTC

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 4, 2003 12:43 AM UTC

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

AD Administrator Syncfusion Team September 4, 2003 06:57 AM UTC

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 06:58 AM UTC

Forgot to attached the sample.

AS Asaf Segal September 4, 2003 09:32 AM UTC

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 02:22 PM UTC

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");
		Console.WriteLine("root level");

Live Chat Icon For mobile
Up arrow icon