0 comments
ASP.NET MVC 2 has validation architecture that support both server-side and client-side validation. ScottGu describes in details how to get validation works in his post ASP.NET MVC 2: Model Validation. The best feature in client-side architecture is that you may use alternative java scripts validation libraries like jQuery validation. There is a steps to get client-side validation works using jQuery validation plug-in:
- Download and add to your ASP.NET MVC project following java scripts:
- jquery-1.4.2.js
- jquery.validate.js
- MicrosoftMvcJQueryValidation.js (ASP.NET MVC 2 Futures download)
I assume you put all scripts into /Scripts folder of your MVC application
- Enable client side validation
- add three JavaScript references to your view

- write one line of code in the view before form

That's it! Now you have Client-side validation using jQuery validation plug-in!
