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]Card View
  [Expand]Vertical Grid
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]HTML Editor
  [Expand]Image and Data Browsing
  [Expand]Docking and Popups
  [Expand]Navigation and Layout Extensions
  [Expand]File Management
  [Expand]Multi-Use Site Extensions
  [Expand]Charts
  [Expand]Pivot Grid
  [Expand]Scheduler
  [Expand]Tree List
  [Collapse]Data Editor 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]Report Extensions
  [Expand]SpellChecker
 [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]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[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

How would you rate this topic?​​​​​​​