Home Forums WinForms controls Xceed Grid for WinForms Add rows to Detail Grid Reply To: Add rows to Detail Grid

User (Old forums)
Member
Post count: 23064

All who have taken an interest in this thread

My problem was assuming that the same loop would work with both grids. I forgot that the detail grid is considered a part of the master grid (or so to say). Therefore, you have to access the master grid, and call the detail grid from it. Here is the process of getting into the rows of the detail grid:

If you have selected a row in the detail grid, you can get teh value in a message box using the following method:

// First remember that the selected row is part of the master grid’s selected row list
foreach (Xceed.Grid.DataRows parentRow in MyMasterGrid.SelectedRows)
{
// now create a row to represent the detail grid’s row
foreach (Xceed.Grid.DataRow row in parentRow.ParentGrid.DataRows)
{
// Now create a cell to represent the cell you want the data from
Xceed.Grid.Cell cell = row.Cells[“MyFirstCell”];
MessageBox.Show(cell.Value.ToString());
}
}

This returns the value in the cell for every row in the child grid.

Thanks Tommy for you help. You got me on the right track.

Imported from legacy forums. Posted by KenG (had 510 views)