ColumnView.CancelUpdateCurrentRow() Method
Cancels changes made to focused row cells.
Namespace: DevExpress.XtraGrid.Views.Base
Assembly: DevExpress.XtraGrid.v24.2.dll
Declaration
Remarks
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.
Records must implement the IEditableObject interface to enable rollback.
Note
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 Views that display real data within the Grid Control. Use the following methods to access these Views with which an end user interacts at runtime.
- 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.
Example
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();