The requested page is not available for the requested platform. You are viewing the content for Default platform.

Input Validation Types

  • 2 min to read

When creating applications that allow users to input values, it is important to check the validity of the values that are entered. The DevExpress Universal Editor Controls provide both automatic and manual input validation facilities.

Automatic Validation Using Masks

User input is automatically controlled by the editor when using the mask functionality. Masks let you specify the pattern used to input values, and an end-user cannot enter text that is not permitted by the mask. Thus, in masked mode the values entered always match the edit masks.

Manual Validation

In some cases, however, you may want to provide manual validation (limit the range of valid values, implement a conditional validation mechanism, etc.). Handle the BaseEdit.Validate event to do this. This event lets you check the value entered into an editor before it is accepted. If the value entered does not meet your requirements, or is of the wrong type, you can indicate that the current value has failed validation.

The BaseEdit.Validate event is raised for an editor if the editor's BaseEdit.CausesValidation property is set to true. Editor validation can fire in the following cases:

You can also use the BaseEdit.DoValidate method to perform validation at any time.

To indicate that the edit value has failed validation, set the IsValid property of the BaseEdit.Validate event's argument to false.