ASP.Net + MVC + VS 2008
Can anyone advise what is the best way of client and server side validation.
Either we go for Data Annotation if it support with VS2008. Or g开发者_如何转开发o with Jquery ...
Can anybody guide me as well any example, link is appreciated.
xVal is highly recommended:
http://xval.codeplex.com/
http://blog.codeville.net/2009/01/10/xval-a-validation-framework-for-aspnet-mvc/
With xVal you can do both client & server side with Data annotations & jQuery or other validation engines like castle....
Data Annotations is a server side technology and jQuery is client side. To do both client/server validation you need both, its not a question of either/or.
The simple answer is "Both!"
You want your users to have a fast, smooth UI so instant feedback is essential (unless you can guarantee that your round-trip time is ultra-fast) and saves on round-trips. However, you cannot guarantee that only your clients with this validated input is being posted to your server so you need to validate there as well.
精彩评论