The ASPxHtmlEditor provides a built-in means to perform powerful validation of its content, both on the client and server. Different validation settings are available for customization through the editor's SettingsValidation property.
To define editor validation logic, the following easy-to-use methods are provided (which can be combined together, if required):
-
The SettingsValidation.RequiredField property can be used to force an editor to require input, and give you the ability to display an error message if input is not received.
-
The editor's Validation event (client or server, or both) can be handled to setup custom editor validation. Review the code sample tabs within this demo, to learn how easy this really is.
Client validation of the ASPxHtmlEditor can be triggered automatically via a click on an ASPxButton, whose CausesValidation property is set to true. You can also manually initiate the editor's client validation by using the editor's Validate client method or specific static client methods (such as the ASPxClientEdit.ValidateEditorsInContainer, ASPxClientEdit.ValidateEditorsInContainerById, ASPxClientEdit.ValidateGroup).
The editor's server validation is always performed during processing of an external postback, if the editor's content has been changed. The server validation can also be initiated programmatically by using the editor's Validate server method, or a specific static server method ASPxEdit.ValidateEditorsInContainer.
Additionally, you are allowed to validate the editor's content programmatically (when required), and indicate the validation result manually, by either setting the editor's IsValid server property or using the SetIsValid client method.
When an editor fails validation logic, a specific error frame containing the error description can be displayed within the editor's View. The error frame's appearance is customized via the SettingsValidation.ErrorFrameStyle property. The error text can be specified by using the SettingsValidation.ErrorText property, in the Validation event's handler, or via the editor's ErrorText property (depending upon the validation method used).
This demo illustrates the built-in flexibility and efficiency of our validation engine, allowing you to easily implement different validation scenarios.