What are the ways to validate form data (in ASP.NET MVC and C#) such as input fields. I try jquery validator but failed. Are there other ways?
Asked
Active
Viewed 278 times
1
-
What do you mean, "but failed"? – Sampson Dec 21 '09 at 20:22
-
I dont prevent posting data from form if any field is emty – Ognjen Dec 21 '09 at 20:27
4 Answers
1
MVC v2 has DataAnnotation Validation Support, see Scott Gu's post on this topic.

Ta01
- 31,040
- 13
- 70
- 99
-
1You can use DataAnnotation Validation in ASP.NET MVC v1.0 as well. http://www.superexpert.com/blog/archive/2008/09/10/asp-net-mvc-tip-43-use-data-annotation-validators.aspx – Keith Adler Dec 21 '09 at 22:33
-
0
ASP.NET MVC 2.0 beta has jQuery validator integrated. Might be worth a look.

Robert Harvey
- 178,213
- 47
- 333
- 501
-
-
2You can do it with MVC 1.0: see here http://www.superexpert.com/blog/archive/2008/09/10/asp-net-mvc-tip-43-use-data-annotation-validators.aspx – Keith Adler Dec 21 '09 at 22:34
0
I recommend use MVC 2 RC, jQuery and jQuery.validate plugin. How it works you can read on Phil Haack's blog. Please, be careful. Phil wrote article in time of MVC 2 Beta. About issues with implementation on RC you can read here: ASP.NET MVC 2 RC client side validation not working.