Way back from DataBoundGrid to underlying DataSet in Hierarchical Grid

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

2 Replies

AD Administrator Syncfusion Team 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());
    }
}


MK Matthias Klein April 5, 2005 07:19 AM UTC

Works like a charm. Thanks alot Matthias.

Loader.
Up arrow icon