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

GridDataBoundGrid - readonly as well as editable rows

I have a requirement in GridDataBoundGrid, some rows I want to be editable and some rows I want it to be readonly. Is there a way I can make the row as readonly or editable based on condition. Guide me to achieve this.

3 Replies

AD Administrator Syncfusion Team August 16, 2005 06:51 AM

You can handle the grid.Model.QueryCellInfo event. There you can set e.Style.ReadOnly = true based on what ever condition you want to use. You would need to set e.Style.ReadOnly = true anytime e.RowIndex points to a row you want to be readonly.


SK Santha Kumar August 16, 2005 08:17 AM

In dbgHolders_QueryCellInfo, I have set the individual cell to readonly when the data is fetched from database with e.Style.ReadOnly = True Note: Some of the columns are editable. Now the requirement is 1. User should not be allowed to delete the existing row (which are fetched from database) 2. user should be allowed to delete the new row added before saving it. Let me know the way i can achieve this.


AD Administrator Syncfusion Team August 16, 2005 09:17 AM

You can set this property to prevent rows from being removed. this.gridDataBoundGrid1.Binder.EnableRemove = false; While the user is editing the AddNew row, he can press esc once to cancel the edit on the currentcell. If he presses esc twice (or ther eis no actively editing currentcell & he presses it once), then the edit on the new record is cancelled (removing the new AddNew record and emptying the one that was being edited).

Loader.
Live Chat Icon For mobile
Up arrow icon