Description:
I have an XtraGrid with several columns and want to prevent some of the columns from being edited. What is the best way of doing this?
Answer:
There are several possible solutions.
-
The first solution is to set the GridView.OptionsBehavior.Editable property to False. In this case, the whole grid becomes read-only.
-
Another solution is to change the ReadOnly or AllowEdit option of your columns.
-
Starting with version 19.2 Grid Control supports Disabled Cell Behavior that allows you to disable individual grid cells with ease.
-
The last solution is to use the ShowingEditor event of the view and disable cell editing via code using the event handler's e.Cancel parameter. You can learn more about this approach in the How to Conditionally Prevent Editing for Individual Grid Cells article.
Note The column's ReadOnly option when activated still allows you to open the in-place editor, but disables editing, you can only select and copy the content of the entered cell or drop the editor's dropdown section for review (this might be useful in case of read only image or memo dropdowns), the other solutions will completely disable any access.
I don't see the Editable option of the GridView.OptionsBehavior property on my grid. Is this for Webforms or WinForms?
How can I achieve this functionality for Webforms?
Thanks in advance
Hello,
I've created a separate ticket on your behalf (How to disable editing). It has been placed in our processing queue and will be answered shortly.