Data Editing Event Sequence
Grid editing follows a well defined sequence of events:
-
When the grid enters edit mode, the CellBeginEdit event is called. The editor is loaded with the current cell value.
-
On every change of the value in the editor, ValueChanging event is fired just before the value is actually changed. The event can be canceled and the current edit rejected.
-
If the ValueChanging is not canceled the value is changed and the ValueChanged event is fired.
-
On closing the editor, the Validating event is fired before the value can be persisted in the grid. If the Validating event is canceled the value is not persisted.
-
If Validating is not canceled, the value is persisted and the Validated event is fired.
-
The CellEndEdit event is called.
-
Finally the editor is closed.
Some of these events may be called multiple times. Here is a sample log of events as a string cell was put into edit mode and the string "new" was typed, then the cell was tabbed away from:
CellBeginEdit
ValueChanging
ValueChanged
ValueChanging
ValueChanged
ValueChanging
ValueChanged
ValueChanging
ValueChanged
Validating
Validated
Validated
CellEndEdit