Cancels changes made to focused row cells.
public virtual void CancelUpdateCurrentRow()
Public Overridable Sub CancelUpdateCurrentRow
Call the CancelUpdateCurrentRow method to discard changes made to cell contents within a focused row. Note that this method is in effect until the row loses focus and if no cell is being edited at present time. To discard changes made to the currently edited cell and close the editor, call the ColumnView.HideEditor method instead.
The ColumnView.UpdateCurrentRow method saves changes made to the focused row. After this method has been called, the CancelUpdateCurrentRow method has no effect.
End-users can also cancel focused row updates. The ESC key must be pressed for this purpose.
Note that records must implement the IEditableObject interface to enable rollback.
Detail pattern Views do not contain data and they are never displayed within XtraGrid. So, the CancelUpdateCurrentRow member must not be invoked for these Views. The CancelUpdateCurrentRow member can only be used with real Views that are displayed within the Grid Control. The real Views with which an end-user interacts at runtime can be accessed using the following methods.
- GridControl.MainView - returns the top most View in a grid;
- GridControl.FocusedView - returns the focused View;
- GridControl.DefaultView - returns the currently maximized View;
- the sender parameter of View specific events;
- GridView.GetDetailView - returns a detail clone View for a specific master row.
The code below discards changes made to the focused record by calling the ColumnView.CancelUpdateCurrentRow method. If an editor is opened for a specific record cell, it is closed while discarding the user's modifications.
ColumnView view = (ColumnView)gridControl1.FocusedView; if (view.IsEditing) view.HideEditor(); view.CancelUpdateCurrentRow();