views:

76

answers:

4

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?

+1  A: 

Here are several useful tutorials on ASP.NET MVC validation.

JacobM
+1  A: 

MVC v2 has DataAnnotation Validation Support, see Scott Gu's post on this topic.

RandomNoob
You 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
Nissan Fan
how validate input field who does not have model function
Ognjen
A: 

ASP.NET MVC 2.0 beta has jQuery validator integrated. Might be worth a look.

Robert Harvey
I use ASP.NET MVC 1.0 in my project
Ognjen
You 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
Nissan Fan
A: 

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.

Martin
In my project I use MVC 1. In next project I will use MVC 2. Tnx
Ognjen