We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Cell Style Allow Edit

I am trying to make a cell not editable based on certain criterias. Based on the querycellstyle function, I could only get the column style as Allow Editable = false. I want to just make that particular cell in the row Allow editable as false. 

Makes entire column not editable and not the specific cell only.
e.Column.AllowEditing = false;

1 Reply

JP Jagadeesan Pichaimuthu Syncfusion Team April 24, 2019 06:21 AM UTC

Hi Julius, 
 
Thanks for using Syncfusion product. 

You can able to achieve your requirement by using the CurrentCellBeginEdit event. In this event you can able to cancel the editing operations for specific cells and you can refer the below code snippet for your reference. Here the first column is not editable except the cell value is 1002.  

this.sfDataGrid1.CurrentCellBeginEdit += sfDataGrid1_CurrentCellBeginEdit; 
 
void sfDataGrid1_CurrentCellBeginEdit(object sender, Syncfusion.WinForms.DataGrid.Events.CurrentCellBeginEditEventArgs e) 
{ 
    DataRowView dataRow = e.DataRow.RowData as DataRowView; 
 
    if (e.DataColumn.GridColumn.MappingName == "Employee ID" && dataRow[0].ToString() != "1002") 
        e.Cancel = true; 
} 
  

You can refer the below documentation link for your reference. 


If we misunderstood your requirement, please provide more information regarding the requirement. This would help us to proceed further. 

Regards, 
Jagadeesan

Loader.
Live Chat Icon For mobile
Up arrow icon