Kumar
Kumar

Reputation: 2863

Validate and display error messages for fields not in model

For fields like Retype Password, Accept Terms and Conditions what is the best strategy to validate these fields both on the server and the client?

Upvotes: 2

Views: 137

Answers (1)

Dustin Laine
Dustin Laine

Reputation: 38503

I used DataAnnotations and add the required, or other validation attributes. Then I use jQuery (or MS Validation) for client side. All is generated if you do it this way.

If you have fields that are not in your regular model, I create new "view" models that match the view. Make your life easier and do this!

Upvotes: 1

Related Questions