Click here to Skip to main content
12,950,084 members (44,093 online)
Rate this:
Please Sign up or sign in to vote.
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.
Posted 3-Aug-12 23:27pm

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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.

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

    Print Answers RSS
Top Experts
Last 24hrsThis month
OriginalGriff 5,749
CHill60 3,380
Maciej Los 2,953
Jochen Arndt 1,935
ppolymorphe 1,820

Advertise | Privacy | Mobile
Web01 | 2.8.170525.1 | Last Updated 4 Aug 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100