BaseView.ValidateEditor() Method
Validates the active editor.
Namespace: DevExpress.XtraGrid.Views.Base
Assembly: DevExpress.XtraGrid.v24.2.dll
Declaration
Returns
Type | Description |
---|---|
Boolean | true if the active editor’s value is accepted; otherwise, false. |
Remarks
The ValidateEditor method allows you to force active editor validation. Do not call this method when the View is not in editing mode. Use the BaseView.IsEditing property to determine the current View mode.
First, the ValidateEditor method performs automatic editor validation by calling the active editor’s BaseEdit.DoValidate method. This method determines whether the value entered can be accepted by the editor. After performing automatic validation, the ValidateEditor method raises the BaseView.ValidatingEditor event. Handle this event to perform manual validation. This enables you to implement custom edit value constraints.
If the editor was not validated successfully, the BaseView.InvalidValueException event is raised. Handle this event to specify how the View should respond to entering an incorrect value.
As implemented in the BaseView class, the ValidateEditor method simply returns true. The method is overridden by derived classes to implement the required functionality.
Note: the ValidateEditor method is called automatically when posting the edit value. This takes place when closing the editor thus saving changes or when calling the BaseView.PostEditor method to post the edit value without closing the active editor.
Note
Detail pattern Views do not contain data and they are never displayed within XtraGrid. So, the ValidateEditor member must not be invoked for these Views. The ValidateEditor 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.