Log In
[Expand]General Information
[Expand]WinForms Controls
[Collapse]ASP.NET Controls and MVC Extensions
 [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]Pivot Grid
  [Expand]Rich Text Editor
  [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
      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]Query Builder
 [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]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Validation Overview

ASP.NET MVC empowers you with the ability to validate user input both on client and server sides.

Client-side validation is performed on the client's browser and allows you to immediately show/hide error messages according to the user input validity. The client-side validation validates the form before it is submitted: if the form is not valid, it won't be submitted.

Server-side validation occurs when a form is submitted to the server. Server-side validation allows you to protect your web application from malicious end-users who can bypass client-side validation.

The code sample below demonstrates how to validate a model class instance on the server side before adding it to the database (if you use model validation or unobtrusive client validation approaches). The AddNewClient(...) action method uses a ModelStateDictionary.IsValid property value to ensure that the model instance has no validation errors. A valid model class instance can be safely added to the database.

Validation Approaches

The table below contains information about validation approaches: their availability on the server or client side and supported ASP.NET MVC versions.

Validation Approach Server or Client Side Availability Supported ASP.NET MVC Versions
Model Validation Client and Server ASP.NET MVC 2 and ASP.NET MVC 3
Unobtrusive Client Validation Client and Server ASP.NET MVC 3 and higher
jQuery Client Validation Client All
Built-in Validation Client and Server All

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