to disable buttoncells on ultragrid in normal mode
I am using this row.Cells["Include"].Activation = Activation.ActivateOnly;
what should i use to disable button cells in GroupBy mode row.Cells is null in GroupBy mode
i tried
row.ParentCollection.ColumnFilters["Include"].Column.CellActivation = Activation.ActivateOnly;
but did not work. Can any one help me please?
Sample:
private void enableDisableBtnCellOnGrid(bool enabled) { foreach (UltraGridRow row in myUltraGrid.Rows) { if (enabled) { if (!row.IsGroupByRow) row.Cells["Include"].Activation = Activation.ActivateOnly; //else // row.ParentCollection.ColumnFilters["Include"].Column.CellActivation = Activation.ActivateOnly; } else { if (!row.IsGroupByRow) row.Cells["Include"].Activation = Activation.Disabled; //else // row.ParentCollection.ColumnFilters["Include"].Column.CellActivation = Activation.Disabled; } } }
Thanks
When you group the grid, it creates a hierarchy. The top level of the hierarchy are GroupByRows. These are the group header rows you see in the grid, and they have no cells, so the Cells collection is null.
The loop you have here is only looping through the top-level rows, which are all GroupByRows. What you could do here is something like this:
foreach (UltraGridRow row in myUltraGrid.Rows.GetAllNonGroupByRows())
By why loop through the rows? The code you have here is setting the CellActivation each individual cell in the column. That's very inefficient. You could just set the CellActivation on the column and avoid the loop entirely.
Thank you. How can i set the cell activation on the column?
this.ultraGrid1.DisplayLayout.Bands[0].Columns["Include"].CellActivation = Activation.Disabled;
Got it.. Thank You