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.

Way back from DataBoundGrid to underlying DataSet in Hierarchical Grid

Thread ID:

Created:

Updated:

Platform:

Replies:

26963 Apr 4,2005 02:17 PM Apr 5,2005 03:19 AM Windows Forms 2
loading
Tags: GridControl
Matthias Klein
Asked On April 4, 2005 02:17 PM

I have a DataSet with 2 tables in it and a relation between those two. I display the DataSet in a DataBoundGrid with a hierarchy (click on the plus-sign shows the child-table). In my program I reach eventually the point where I have a row-index and want the corresponding DataRow from the DataSet. I guess I’m missing the point somewhere because it can’t be that hard. Therefore my questions: What is the easiest way to back from the Row-Index to a DataRow in the DataSet? How can I determine which table the row-index belongs to? Do I have to take care of possible collapse/expand-states? Greetings Matthias Klein

Administrator [Syncfusion]
Replied On April 4, 2005 03:43 PM

You can get this from the GridBoundRecordState for the row. Here is some code .
 
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());
    }
}

Matthias Klein
Replied On April 5, 2005 03:19 AM

Works like a charm. Thanks alot Matthias.

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.

;