The Elegant Grid provides both the standard facilities for data editing and support for custom editors.
ColorCell cell types have built-in standard editors. That means data editing is always available for cells of these types. If, for some reason, standard editing doesn't meet your needs or you want to provide your own editor for a particular cell type, you need to implement the
ICellEditor interface yourself (Read Custom Cell Editors for details).
Methods, Properties and Events for Data Editing
The following table lists some methods and properties of the
Cell class relating to cell editing.
|Shows whether the cell is being edited or not.|
|Starts cell editing in the grid control.|
|Persistently saves any changes made to the cell. It takes one argument that specifies whether cell editing should be ended.|
|Cancels cell editing.|
GridControlBase class supports a number of events relating to data editing. These events are shown in the table below.
|Occurs when cell editing is starting. You can use this event to determine if editing is allowed for a particular cell at run time.|
|Occurs when editing has started.|
|Occurs when editing has been cancelled.|
|Occurs when changes made to the cell during editing has been committed.|
|Occurs when editing has ended.|
|Occurs when all the data changes in the cell are about to be committed or when some data have changed in the editor. You can use this event to implement some custom logic, e.g. to cancel committing the changes.|
You can enable or disable editing for a particular cell using the
GridControlBase.EditingCell property allows you to determine which cell is currently edited. If none of the cells is edited, the property returns null.
Sometimes you may need to know if editing is enabled for a particular cell at run time. The
GridControlBase.CellEditStarting event handler receives an object of the
CellCancelEventArgs class. It exposes the
CellCancelEventArgs.Cancel property which in this case indicates if editing is allowed for the given cell. You can also change this property value to enable or disable editing.