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
1910
Disabe cell editing based on another cell's value
posted

I have a WebDataGrid with the following columns: Service_Date and Approved

If in a record, the Approved field = 1, I don't want the user to be able to edit the Service_Date cell for that record...but only for that record. If in another record, the Approved field = 0, then I want the user to be able to edit the Service_Date cell for that record.

In UltraWebGrid, it was so easy...I could simply do the following in the InitializeRow code:

        If e.Row.Cells.FromKey("Approved_Flag").Value = 1 Then 'checked
                e.Row.Cells.FromKey("Service_Date").AllowEditing = Infragistics.WebUI.UltraWebGrid.AllowEditing.No
        End If

Can you please give a specific example of how to do this?

Parents
No Data
Reply
  • 37874
    posted

    Hi algunderson,

    A possible approach would be to cancel EnteringEditMode client-side event for rows where Approved_Flag equals 1:

     function EnteringEditModeHandler(sender, eventArgs) {
        var currentRow = eventArgs.getCell().get_row();
        var approved = currentRow.get_cellByColumnKey("Approved_Flag").get_value();
        if (approved == 1) {
            eventArgs.set_cancel(true);
        }
    }

    If you have any questions, please let me know.

Children