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. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Way back from DataBoundGrid to underlying DataSet in Hierarchical Grid

Thread ID:

Created:

Updated:

Platform:

Replies:

26963 Apr 4,2005 06:17 PM UTC Apr 5,2005 07:19 AM UTC WinForms 2
loading
Tags: GridControl
Matthias Klein
Asked On April 4, 2005 06:17 PM UTC

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 07:43 PM UTC

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 07:19 AM UTC

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.

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

;