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.
Unfortunately, activation email could not send to your email. Please try again.

Geting event on selection in hierarcial Grid

Thread ID:

Created:

Updated:

Platform:

Replies:

6856 Sep 2,2003 03:24 AM Sep 4,2003 10:22 AM Windows Forms 6
loading
Tags: GridControl
Asaf Segal
Asked On September 2, 2003 03:24 AM

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

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

Asaf Segal
Replied On September 3, 2003 08:43 PM

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

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

Administrator [Syncfusion]
Replied On September 4, 2003 02:58 AM

Forgot to attached the sample.

Asaf Segal
Replied On 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.

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

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.

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.

;