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. (Last updated on: June 24, 2019).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

Cell Style Allow Edit

Thread ID:

Created:

Updated:

Platform:

Replies:

144186 Apr 23,2019 11:00 PM UTC Apr 24,2019 06:21 AM UTC WinForms 1
loading
Tags: SfDataGrid
Julius
Asked On April 23, 2019 11:00 PM UTC

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;

Jagadeesan Pichaimuthu [Syncfusion]
Replied On 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

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

This page will automatically be redirected to the sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon

Live Chat Icon For mobile
Live Chat Icon