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
close icon

Editable and Readonly column

Hi, Am adding a new row to the grouping grid on click of a button.In this new row,I need to make only the 3rd column editable and the remaining readonly. I am able to achieve this partially by using grd1_QueryCellStyleInfo event and making : if(e.TableCellIdentity .ColIndex == 3) e.Style.ReadOnly = false; The problem is that then the 3rd column of ALL the rows become editable. Doing (e.TableCellIdentity .RowIndex== 0 && e.TableCellIdentity .ColIndex == 0) doesnt work.

1 Reply

AD Administrator Syncfusion Team June 22, 2006 10:20 PM UTC

Hi Sh, Regarding AddNewRecord : Could you try this code in QueryCellInfo event to make a cell as readonly cell in a grid. Here is a code snippet. if(e.TableCellIdentity.DisplayElement.Kind == DisplayElementKind.AddNewRecord ) { if(e.TableCellIdentity.ColIndex == 3) { e.Style.Readonly = false; } else e.Style.Readonly = true; } Regarding Newly Added Record: You need to handle the SourceListRecordChanging event to find the newly added record and set the readonly property of the record in QuerycellInfo event. Please find the code snippet. Record NewRecord = null; private void gridGroupingControl1_SourceListRecordChanging(object sender, Syncfusion.Grouping.RecordChangedEventArgs e) { if( e.Action = RecordChangedType.Added ) { NewRecord = e.Record; } } if( NewRecord != null && NewRecord == e.TableCellIdentity.DisplayElement.ParentRecord) { if(e.TableCellIdentity.ColIndex == 3) { e.Style.Readonly = false; } else e.Style.Readonly = true; } Here is a sample. http://www.syncfusion.com/Support/user/uploads/AddNewRecord_994b98ae.zip Let me know if this helps. Best Regards, Haneef

Loader.
Live Chat Icon For mobile
Up arrow icon