10433 : Readonly cells

Question

Id like to to prevent a user from editing grid cells.  The only way Ive been able to do this is set:

GridNode.GridControl.Enabled = false

Unfortunately this also prevents the user from scrolling the grid.  Is there a way where I can leave the grid control enabled, but prevent the user from changing the text in the nodes?

Answer

Yes, that is not the recommended approach. Instead you should implement the OnBeforeEditCell event, and set the e.editAllowed=false, it will do the trick much better.

And also it will allow you to evaluate the cell so that it can be made editable under certain dynamic circumstances that you decide.

If you want to dis-allow edit all together you can simple set the GridColumns[x].Readonly=true.

Leave a Reply