Monday , December 11 2017
Home / Dot Net / How to Use Remote Validation in MVC

How to Use Remote Validation in MVC

Remote Validation Attribute allows us to validate properties values with server callback using AJAX. Remote Validation Attribute is available in System.Web.MVC.
Let an Example User wants to fill details in Registration Page . It contains Fields like UserId, Password, EmailId, Qualification, Mobile Number, Mean while to check whether UserId is already used or not with out submitting complete form data.Using Remote Validation Attribute we can solve this scenario.

Note: this feature is available on or after releases of MVC-4 version.

Please follow bellow steps:

  1. Add System.Web.Mvc namespace to Model.
  2. Add Remote Validation Attribute to Model Property.
  3. Check whether these files are existed in your scripts folder (jquery.validate.min.js  &  jquery.validate.unobtrusive.min.js ) if not download it from nuget package manager.
  4. Import these JS files into Layout page or else View Page.
  5. Let Create JSONResult Action to perform validation.

When ever focus out from control automatically it invokes specified action.

 

Screen:1

Remote Validation in MVC

Screen:2

Remote Validation in MVC

Screen:3

Remote Validation in MVC

 

 

Print Friendly, PDF & Email

Give us your valuable feedback

comments

About balamurali devara

Check Also

Lesson 6: Boxing and UnBoxing in C#

Boxing and UnBoxing in C#: Previously we have seen TypeCasting Now We Will see Boxing and …

%d bloggers like this: