Im using 13.1 controls... I have 2 grids grdMain and grdSupp. Both have layouts dependent on a couple of rules. If rule 1 is invoked then certain cells are edit enabled and background colored yellow. If rule 2 is invoked then no cells are editable and the background color is set to color.empty.
When I reset to force rule 2, [grdSupp.Rows.Refresh(RefreshRow.FireInitializeRow);] fires and InitializeRow for grdSupp gets called. However when I call
[grdMain.Rows.Refresh(RefreshRow.FireInitializeRow);] InitializeRow does NOT fire.
My question is what would inhibit the InitializeRow event from firing?
Yes, once you group, it creates a hierarchy of row, so you need to pass in true for recursive. :)
Ok, tried that .... still did not work:
Here's my code:
resetToolStripMenuItem.Click += delegate
{
grdMain.Rows.ExpandAll(true);
grdMain.Update();
grdMain.Rows.Refresh(RefreshRow.FireInitializeRow);
};
I tried the following and this seems to work...
grdMain.Rows.Refresh(RefreshRow.FireInitializeRow,true);
I set the second parameter for recursion to true.
Try calling:
row.ExpandAll();
grid.Update(); // This forces a paint
and then Refresh(FireInitializeRow)
I use Rows.ExpandAll(true); but the event InitializeRow still does not fire. I need to use the InitializeRow event as this is where I have rules dictating whats editable and whats not at whatever point and time.
InitializeRow fires for Data Rows. There's a separate event (InitiailizeGroupByRow) for GroupbyRows. If you grid is grouped, then the root-level rows are GroupByRows, not data rows. So you just need to handle the InitiailizeGroupByRow event.
If you are trying to fire InitializeRow for the data rows underneath the GroupByRows, then you may need to expand the GroupByRows first, either by calling ExpandAll of setting Expanded to true on the rows you want.