malik
malik

Reputation: 333

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 go with Jquery ...

Can anybody guide me as well any example, link is appreciated.

Upvotes: 3

Views: 176

Answers (3)

Jace Rhea
Jace Rhea

Reputation: 5018

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.

Upvotes: 1

Kevin LaBranche
Kevin LaBranche

Reputation: 21078

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....

Upvotes: 6

Lazarus
Lazarus

Reputation: 43074

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.

Upvotes: 0

Related Questions