简体   繁体   中英

Asp.Net MVC 2.0 client side validation VS 2010

There seems to be some confusion, at least for myself, on client side validation using the data annotations framework and

<% Html.EnableClientValidation(); %>  

Most of the examples I have seen like on haacked.com use the following scripts

jquery.validate.js

MicrosoftMvcJqueryValidation.js

However, visual studio 2010 asp.net mvc 2 project doesn't include the MicrosoftMvcJqueryValidation.js

Instead, I was able to get some client validation working using

MicrosoftAjax.js

MicrosoftMvcValidation.js

Does anyone know why two different ways are supported for doing client-side validation and why both options are not present in visual 2010?

Client side validation in ASP.NET MVC is extensible (specifically section called Validation using jQuery Validation? ).

MicrosoftMvcJqueryValidation.js is an adapter that let's you use jQuery validation with ASP.NET MVC, it doesn't look like it's the default validation framework out of the box though (that's what the other JS validation files are).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM