Professional UI Solutions
Site Map   /  Register

Data Editing

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 Editing

The following table lists some methods and properties of the Cell class relating to cell editing.

Cell.Editing propertyShows whether the cell is being edited or not.
Cell.StartEdit methodStarts cell editing in the grid control.
Cell.CommitEdit methodPersistently saves any changes made to the cell. It takes one argument that specifies whether cell editing should be ended.
Cell.CancelEdit methodCancels cell editing.

The GridControlBase class supports a number of events relating to data editing. These events are shown in the table below.

GridControlBase.CellEditStartingOccurs when cell editing is starting. You can use this event to determine if editing is allowed for a particular cell at run time.
GridControlBase.CellEditStartedOccurs when editing has started.
GridControlBase.CellEditCancelledOccurs when editing has been cancelled.
GridControlBase.CellEditCommittedOccurs when changes made to the cell during editing has been committed.
GridControlBase.CellEditEndedOccurs when editing has ended.
GridControlBase.ValidateEditingCellDataOccurs 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 Information

You 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.

Back To Top Other Articles...