BaseView.ValidateEditor() Method

Validates the active editor.

Namespace: DevExpress.XtraGrid.Views.Base

Assembly: DevExpress.XtraGrid.v20.1.dll

Declaration

public virtual bool ValidateEditor()
Public Overridable Function ValidateEditor As Boolean

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

See Also