This example demonstrates how to cancel editing or disable the editor conditionally for the grid when batch editing is in use. It is possible to execute your logic either on the client or server side for a complex business model.
Then, handle the grid's client-side BatchEditStartEditing event to either cancel the edit operation using the e.cancel property:
[JScript]if(condition) e.cancel = true;
or disable the editor by obtaining its client instance:
[JScript]var editor = s.GetEditor(e.focusedColumn.fieldName); editor.SetEnabled(condition);
The custom server-side logic can be executed in the CustomJSProperties event handler:
[C#]protectedvoidASPxGridView1_CustomJSProperties(objectsender,DevExpress.Web.ASPxGridView.ASPxGridViewClientJSPropertiesEventArgse){varclientData=newDictionary<int,object>();vargrid=senderasASPxGridView;for(inti= 0;i<grid.VisibleRowCount;i++){varrowValues=grid.GetRowValues(i,newstring[]{"ID","ServerSideExample"})asobject[];varkey=Convert.ToInt32(rowValues[0]);if(key% 2 != 0)clientData.Add(key,"ServerSideExample");}e.Properties["cp_cellsToDisable"]=clientData;}
See Also:
ASPxGridView - How to disable editing for rows that match some condition in Batch Edit Mode
GridView - Batch Editing - How to cancel editing or disable the editor conditionally