The Elegant Grid provides both the standard facilities for data editing and support for custom editors. The TextCell , NumericCell , ComboBoxCell , CheckBoxCell , DateTimeCell , and 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 EditingThe following table lists some methods and properties of the Cell class relating to cell editing. Member | Description |
---|
Cell.Editing property | Shows whether the cell is being edited or not. | Cell.StartEdit method | Starts cell editing in the grid control. | Cell.CommitEdit method | Persistently saves any changes made to the cell. It takes one argument that specifies whether cell editing should be ended. | Cell.CancelEdit method | Cancels cell editing. |
The GridControlBase class supports a number of events relating to data editing. These events are shown in the table below. Event | Description |
---|
GridControlBase.CellEditStarting | Occurs when cell editing is starting. You can use this event to determine if editing is allowed for a particular cell at run time. | GridControlBase.CellEditStarted | Occurs when editing has started. | GridControlBase.CellEditCancelled | Occurs when editing has been cancelled. | GridControlBase.CellEditCommitted | Occurs when changes made to the cell during editing has been committed. | GridControlBase.CellEditEnded | Occurs when editing has ended. | GridControlBase.ValidateEditingCellData | 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. |
Additional InformationYou can enable or disable editing for a particular cell using the CellStyle.AllowEdit property. 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.
|