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.
Syncfusion Feedback

Find the grid''s RowIndex of a DataRow from a nested DataTable

Thread ID:





49744 Sep 26,2006 03:44 AM Sep 26,2006 05:48 AM Windows Forms 2
Tags: GridControl
Timothy Duly
Asked On September 26, 2006 03:44 AM

I have a set of 3 tables. One table is the root table and the others are subsequent child tables.
Root Table
¦-Child Table
¦-GrandChild Table

How is it possible to retrieve the grid''s RowIndex of a given DataRow from a nested table? I have tried to use PositionToRowIndex and similar functions but they simply return the rowIndex of the root table and not the child table.

The reason for this is that I am remembering the state of a grid (ie what rows where expanded/collapsed including nested tables) so that after a refresh I can set the grid back to the state that it was in before the refresh.

Your help in this matter would be most appreciated.

Administrator [Syncfusion]
Replied On September 26, 2006 05:25 AM

Hi Tim,

You can get this from the GridBoundRecordState for the row. Here is some code snippet.

GridBoundRecordState rs = this.gridDataBoundGrid1.Binder.GetRecordStateAtRowIndex( gridRowIndex );
int pos = rs.Position;
CurrencyManager cm = rs.ListManager as CurrencyManager;
if(cm != null)
DataView dv = cm.List as DataView;
if(dv != null)
DataRow dr = dv[pos].Row;
Console.WriteLine(dr[0].ToString() + " " + dr[1].ToString());

Best Regards,

Timothy Duly
Replied On September 26, 2006 05:48 AM

How did you get the GridRowIndex in the first place? It is the RowIndex that I am trying to find.

Basically, I have a DataRow from a nested table that I have selected programmatically and not through clicking on the grid. I now need to find out the grid''s RowIndex of this DataRow.


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.

Warning Icon 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.Close Icon