Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
305
How to disable buttonCell in Groupby Mode
posted

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

Parents
No Data
Reply
  • 469350
    Verified Answer
    Offline posted

    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.

     

Children