Hello,
I have the following question concerning the GridDataBoundGrid control (v.4.4.0.51):
How can I refer to a grid row that contains a specific record, based on the level of the table that contains this record and the position of this record in the table?
For example, in the "ExportGrid" sample, if I expand the 2nd row ("CategoryName = Condiments") in the topmost table and then the 5th row ("ProductName = Northwoods Cranberry Sauce") in the nested table, how can I programmaticaly determine the grid-relative row index of the 6th record ("OrderID = 10709") in the OrderDetails table?
So far, I can only guess that this can be done by iterating through the grid rows and checking the displayed text, or something like that. I am just wondering if there is a simpler way to do that. Any help will be greatly appreciated.
Thanks,
Helen
HE
Helen
April 4, 2007 01:00 PM UTC
I've found a simple solution, but it assumes that all records in the table above the desired record are collapsed:
int GetChildRowIndex (GridDataBoundGrid grid, int ParentRowIndex, int Level, int RecordIndex) {
return ParentRowIndex + grid.Binder.GetHierarchyLevel(Level).RowCountPerRecord*(RecordIndex + 1);
}