Hello,
I have a singleBand grid binded to a typed dataset. On the grid i have added (with the designer of the grid) a column with type = bool, and key="Download".
To get all the checked rows i have hooked-up/registered a method on the CellChange event of the grid !
here it is
private void ultraGrid_ABC_CellChange(object sender, Infragistics.Win.UltraWinGrid.CellEventArgs e) { foreach (UltraGridRow row in ultraGrid_ABC.Rows) { row.Update(); if ((bool)row.Cells["Download"].Value))//if selected
{
// do something
} }
}
this code is working only if i have not grouped-by.
Doing a groupby a column i get a null reference on row.Cells, so row.Cells is null !
why does not work ?
thank you.
This won't work because when the grid is grouped, it changes the hierarchy. The top-level rows in the grid will be the GroupBy rows (which have no cells) and the "real" rows will be children of those rows.
The easiest way to deal with this is to change how you get the rows. You don't care about the groupby rows for the purposes of this loop, so you can get all the "real" rows like so:
foreach (UltraGridRow row in ultraGrid_ABC.Rows.GetAllNonGroupByRows())
an article on the kb solves the problem.
i have used the GetAllNonGroupByRows() method because i dont care about the groupby.
what if i want to get the rows of a specific group ?
thank you
Then you would get the rows from the GroupByRow's Rows collection.