Click here to Skip to main content
16,016,712 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi friends,

I have just started to use the MVC 3.0.
Please suggest me how we apply the validation on the page.

I am very confused how to validate the data
and what level
I have tried google but it was totally out of my scope

1)Model level validation
2)custom validation
3)self validation model.
4)Remote validation.
5)Server side validate.

Please help me.
Thanks
Posted

1 solution

You can do what ever you like. You should ALWAYS validate on the server, client side validation can be easily hacked. You can write client side code, too. It's possible to annotate your viewmodel, but only to the top level, so you can't have a class inside your viewmodel and then have the properties of that class be validated using the built in validation. For me, this is reason alone to never use it, but you can.

Just make sure you always validate on the server, and add client side validation for convenience, using whatever method you like.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900