Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Expand]WinForms Controls
[Collapse]ASP.NET Controls and MVC Extensions
 [Expand]Prerequisites
 [Expand]What's Installed
 [Expand]Common Concepts
 [Expand]ASP.NET WebForms Controls
 [Collapse]ASP.NET MVC Extensions
  [Expand]Product Information
  [Expand]Getting Started
  [Expand]Common Concepts
  [Expand]Grid View
  [Expand]Tree List
  [Expand]Card View
  [Expand]Reporting
  [Expand]Charting
  [Expand]Pivot Grid
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Scheduler
  [Expand]Site Navigation and Layout
  [Expand]HTML Editor
  [Expand]Vertical Grid
  [Collapse]Data Editors Extensions
    Editor List
    Main Features
   [Collapse]Common Concepts
     Binding Data Editors to Data
     Getting Editor Values
     Mask Editing
    [Collapse]Validation
      Validation Overview
      Model Validation
      Unobtrusive Client Validation
      jQuery Client Validation
      Built-in Validation
      Remote Validation
      Displaying Validation Error Messages
      Validating Dynamically Loaded Forms
     Accessibility Support
   [Expand]Editor Types
   [Expand]Strongly-Typed Editor Types
  [Expand]Docking and Popups
  [Expand]File Management
  [Expand]Data and Image Navigation
  [Expand]Multi-Use Site Extensions
  [Expand]SpellChecker
  [Expand]Query Builder
 [Expand]Localization
 [Expand]Redistribution and Deployment
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Built-in Validation

DevExpress MVC data editors provide a built-in server and client side validation API. You can customize an editor's validation settings on the client or server or both.

Note

Built-in validation is not performed when specifying validation attributes for a model class properties (Unobtrusive Client Validation).

Expanded Server Side Validation

Use the following properties to define editor validation logic:

When an editor fails validation logic, a specific error message containing the error's description can be displayed. The ValidationSettings.Display property specifies the error message’s render style.

The error frame's appearance can be customized via the ValidationSettings.ErrorDisplayMode property. The ValidationSettings.ErrorFrameStyle settings specify whether the error's description is displayed as an image or text (or both) in an error frame. To define an error image, use the ValidationSettings.ErrorImage property. The error text can be specified using the ValidationSettings.ErrorText property or Validation event's handler.

The code sample below demonstrates how to perform a validity check on the server side.

View code (Razor):

Controller code ("ValidationController.cs"):

Expanded Client Side Validation

An editor's Validation client event can be handled to specify the editor’s custom validation logic.

Editor validation is automatically triggered by changing the editor's value whenever the ValidationSettings.ValidateOnLeave option is enabled. You can manually initiate editor validation using the editor's Validate client method or specific static client methods (such as the ASPxClientEdit.ValidateEditorsInContainer, ASPxClientEdit.ValidateEditorsInContainerById, ASPxClientEdit.ValidateGroup).

The code sample below demonstrates how to perform a validity check on the client side.

Expanded See Also

Is this topic helpful?​​​​​​​