Show theme settings Shopping cart Download trialFree Trial
Change Theme Settings
Change Theme Settings
Themes
 
Show All Themes
v
...v

Validation

  • v
  • v
  • Bold (Ctrl+B)
  • Italic (Ctrl+I)
  • Underline
  • Strikethrough
  • Align Left (Ctrl+L)
  • Align Center (Ctrl+E)
  • Align Right (Ctrl+R)
  • Justify (Ctrl+J)
Length of HTML code representing the Editor's content (in characters): 221
Submit


This demo illustrates the content validation capabilities available to you within the DevExpress MVC HTML Editor. You can define Editor content validation logic - both on the client and server - using the following methods:

  • Check if content is empty. Apply the Required attribute to the model property containing the HTML content to force the editor to require input and display a prompt message when validation fails.
  • Provide validation settings by applying the HtmlSettings attribute to the model property containing the HTML content. Validation settings are specified as parameters of this attribute. For example, the AllowScripts parameter allows you to specify whether or not to accept HTML markup containing scripts.
  • Provide custom validation logic on the server side by assigning a custom delegate to the HtmlEditorBinderSettings.ValidationHandler property.
  • Provide custom validation logic on the client side by handling the Editor's Validation client event or passing the delegate method as a parameter to the extension's GetHtml function, called within the Validation action.

You are free to combine these methods together to augment validation rules when required.

Collapse/Expand
Local Copy of this Demo
To inspect the source code for this demo on your machine, you must first install our components via the DevExpress Component Installer.
You can open a local copy of this online demo directly from this webpage (if using v20.2.8, 21.1.4 or higher).
Open CS Solution
The source code files for this demo are installed (by default) in the following directory:
\Users\Public\Documents\DevExpress Demos XX.X\Components\ASP.NET\CS\MVCxHTMLEditorDemos