In the grid, it have the <CellEditingClientEvents EnteringEditMode="grid_CellEditing_EnteringEditMode" /> there. The function stops the editing of the other fields but doe not stop editing from happening on the checkbox fields.
function grid_CellEditing_EnteringEditMode(sender, eventArgs) { eventArgs.set_cancel(true)}
Thank you! This definitely helped get it working. I really appreciate your help.
Hello,
Thank you for the additional code you have sent.
You can perform a check inside CellValueChanging event if the cell which will be edited (in this case checked/unchecked) is actually the checkbox which is part of the row and another check to see the current state of the “Approved_Flag” and use, as how you have described, EnteringEditMode for the other cells.
Following this approach I have created a small sample. If you uncheck “Approved_Flag” (which in this sample is another checkbox) you be able to edit all the cells. The “Approved_Flag” will always be editable in this scenario as CellValueChanging currently is not affecting it.
Sincerely,NickEntry-Level Software Developer
6406.WebDataGrid_BoundCheckBox.zip
I have a couple of things going on. I want the user to be able to edit the field only if the approved checkbox is not checked on that particular row. So, if the approved checkbox is checked, I want editing disabled for that particular row. I have added the following two functions: EnteringEditMode and CellValueChanging
The EnteringEditMode seems to handle the fields that aren't checkboxes correctly. It allows for editing if the approved box is not checked and does not allow editing if the approved box is checked...unless the field the user is editing is another checkbox field. If it is, it is allowing the edit.
The CellValueChanging does seem to not allow the edit of the checkbox field, but it is disabling it on all rows rather than only the ones where the approved checkbox is checked. It doesn't seem to be taking into account the "if (eventArgs.getCell().get_row().get_cellByColumnKey("Approved_Flag").get_value() == true)" at all. Also, once the CellValueChanging function is present, it seems to allow the user to think they are editing the non-checkbox fields because it looks like it goes into edit mode , but then once they make their edit, it does a postback and the edit is not made.
function grid_CellEditing_EnteringEditMode(sender, eventArgs) {if (eventArgs.getCell().get_row().get_cellByColumnKey("Approved_Flag").get_value() == true) {eventArgs.set_cancel(true)}}
function grid_Editing_CellValueChanging(sender, eventArgs) {if (eventArgs.getCell().get_row().get_cellByColumnKey("Approved_Flag").get_value() == true) {eventArgs.set_cancel(true)}}
Hello Angela,
Thank you for the code sample you have sent.
Clicking on BoundCheckBoxField will not trigger it to go into edit mode and EnteringEditMode will not be cancelable. You can use CellValueChanging event instead.
function WebHierarchicalDataGrid1_Editing_CellValueChanging(sender, eventArgs){ //my custom logic eventArgs.set_cancel(true); }