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
80
How to disable BoundCheckBoxField for specific rows
posted

I have WebHierarchicalDataGrid. In the root band, there is a check box (BoundCheckBoxField). There is also a hidden column that controls whether or not the row should be editable.

How can I dynamically (row-by-row) set whether or not the check box is editable?

I am aware of the CellEditing behavior, but that can only be set for the whole column, not for specific rows/cells. I have also seen in other posts where it is recommended that the EnteringEditMode client side event be handled and eventArgs.set_cancel can be used to prevent the edit from beginning. That's fine for BoundDataField columns, but the EnteringEditMode event is never fired for the check box column. I have tried handling the grid click event and am able to detect the checkbox column and check the data I have in another column in the row, but the set_cancel does nothing to prevent the box from being toggled. Furthermore, it looks like the check box is toggled before the event is even raised.

Is there another client side event I can use to prevent a check box cell from being edited?

Parents
No Data
Reply
  • 2490
    Verified Answer
    Offline posted

    Hello Nick,

    In order to disable the checkbox you can use CellValueChanging event rather than EnteringEditingMode.
    For example:

    <Behaviors>
    <ig:EditingCore EnableInheritance="True" Enabled="true">
    <EditingClientEvents CellValueChanging="WebHierarchicalDataGrid1_Editing_CellValueChanging"/>
    <Behaviors>
    <ig:CellEditing EnableInheritance="true">
    <EditModeActions EnableOnActive="True" MouseClick="Single" />
    </ig:CellEditing>
    </Behaviors>
    </ig:EditingCore>
    </Behaviors>

    And depending on the custom logic you can effectively cancel a checkbox of been checked/unchecked:

    function WebHierarchicalDataGrid1_Editing_CellValueChanging(sender, eventArgs) {
    //my custom logic 
    eventArgs.set_cancel(true);
    }

    Note that if you set in the WebHierarchicalDataGrid's Behaviors with the EnableInheritance="True", this affect all the child levels. If you want to further modify a specific child logic you can again set it in that child's Behaviors and modify it.

    Sincerely,
    Nick
    Entry-Level Software Developer

Children