I have a whdg and need to access the child rows from the parent row. More specifically, one of the columns on the parent row uses information from the child band to set its value. I have tried to get the information through the initialize row event as follows:
protected void whdg1_InitializeRow(object sender, RowEventArgs e)
{
//There is no method on e to get the child rows
}
I am looking for something that is similar to the Rows method in the UltraGrid:
UltraGridRow row;
Hi bpg730,
To access the child rows of a row, you have to go through its RowIslands collection to get to its child grids first. So in this example.
ContainerGridRecord row = (ContainerGridRecord)e.Row; ContainerGridRecordCollection childRows = row.RowIslands[0].Rows;
Although depending upon load on demand and whether the children have been bound yet, these might not be available.
regards,David Young
In the small test case that I built, I create and bind the data on the page load event. I tried what you said both with the default load on demand behavior and with the initialDataBindDepth set to -1 to load all of the children (there is only one child band) but in both cases the row variable has 0 elements. Is there a way to change my grid to be able to have your example work or is there another way to access the child rows?