no

How to Fix Mvc3 Ajax Validation Using Jquery

To make automatic validation using data annotation on a model on mvc3 c# we need: 1.) A model with data annotation (ex. required attribute)...

To make automatic validation using data annotation on a model on mvc3 c# we need:
1.) A model with data annotation (ex. required attribute).
2.) Form with jquery declaration (jquery1.7, validate, validate unobtrusive, and unobtrusive-ajax. All are available under Scripts directory on an MVC template project. Note that you can update your jquery library using NuGet.
3.) App.config with <add key="ClientValidationEnabled" value="true"/> defined.

Normally, with this requirement validation should work fine. But if the form is served via ajax call, you need to rebind the form to the validator elements  using the ff code:
//your_div is the id of your element which contains the form
$.validator.unobtrusive.parse($('#your_div'));

Related

c# 4963750605772711729

Post a Comment Default Comments

item