What are validation options for ASP.NET MVC - asp.net-mvc

What are my validation options with .net mvc?
Do any of them have a nice validation summary like webforms did?

You can use a MVC html validation summary,see this blog
http://blog.maartenballiauw.be/post/2008/08/29/Form-validation-with-ASPNET-MVC-preview-5.aspx

xVal is the best one. We implemented in three web applications and we will use it in many more in the future(until we find a better one than this). Check the details of xVal here
http://blog.codeville.net/2009/01/10/xval-a-validation-framework-for-aspnet-mvc/

Related

Is xVal obsolete with MVC 2?

Now that built-in validation is supported with MVC 2 framework, should we be using it instead? Are there any advantages that xVal has over MVC 2 validation?
The main reason I ask is that we have a couple MVC sites that use it, and it appears xVal is no longer being maintained/supported. If this is the case, I'd like to start changing our sites over to use MVC 2 validation.
Thanks in advance.
The jQuery validation scripts included with MVC2 are fully supported by Microsoft, so I would prefer them over third-party scripts, especially ones that no one is actively supporting. The xVal Codeplex site clearly lists xVal as only supported with MVC1.0.

Form to add products to the database on asp.net Mvc2

Its my first time with asp.net MVC 2. Im came from asp.net webforms.
I would like to know how to build a form to add products (for instance) to a database with client and server validation.
Do you have any url useful that explains this?
Thanks in advance.
Best Regards.
Josema.
Try looking through Jon Galloway's MVC Music Store, it's a demo application that might help you. Otherwise the MVC2 articles on Scott Guthrie's Blog will also give you the basics.
This is a very broad question. There are many tutorials out there on how to perform this. For example as far as validation is concerned you might look at DataAnnotations which allow you to annotate your view models with attributes which will be used to perform server side and client side validation (if you enable it). For more advanced scenarios you could also take a look at FluentValidation.

Which validation framework is better?

Does anyone have any recommendations for either of these validation ASP.Net MVC Validation frameworks?
xVal: http://xval.codeplex.com/
FluentValidation: http://fluentvalidation.codeplex.com/documentation
NHibernate.Validator
DataAnnotations
by the way: my project use sharp-architecture
This is a personal opinion, xVal and FluentValidation have there pro's and con's. NHibernate.Validator is lighter weight, and functions better if you are already using NHibernate as your schema loader. Then the obvious DataAnnotations is built into ASP.NET which is always something hard to resist.
Personally I use xVal for the built in jQuery validation.
If you're using MVC 2, DataAnnotations and an xVal-like client side validation is built in.
If you're using MVC 1, you can use xVal alongside DataAnnotations. In fact, xVal by itself won't do anything for you--it's just a technology to link a server-side validation framework like DataAnnotations to a client-side validation framework like jQuery validation.
We're using DataAnnotations + xVal on a project and it's worked out all right. We needed to make some changes to the DataAnnotationsModelBinder.

Form input validation options in ASP.NET MVC 1.0+

A number of questions have been asked on this topic before, but since ASP.NET MVC is moving quite fast I wanted to re-ask the question:
What would you recommend for providing form input validation in ASP.NET MVC?
Requirements:
Server-side checking
Client-side (JavaScript) checking
Should cover the basics such as mandatory fields, numeric range validation, regex validation
(So basically all (or most) of the stuff that the ASP.NET WebForms validation controls do)
Current options seem to be:
Validator Toolkit on CodePlex
Jumping to ASP.NET MVC 2 Preview 1 (Our application is for internal use and go-live is in 6 months, so we might be comfortable using the preview)
xVal should be good choice in your case.
I would use DataAnnotations, is going to be a part of MVC but can be compiled and used in 1.0.
http://www.asp.net/learn/mvc/tutorial-39-cs.aspx
/M
FluentValidation also has an MVC component, however it doesn't do the client side of things. Ideally this could be integrated with xVal.

how-to enable Client-Side validation fora textbox

how-to enable Client-Side validation for a ordinary textbox in ASP.NET MVC.
Scott Guthrie just published a good article on validating models -- and you should think about it as model validation, not textbox validation -- in ASP.NET MVC 2.0. You might want to check out how they do validation in the NerdDinner example at http://nerddinner.codeplex.com/.
There are various options. If you are using MVC 1 you might want to read this article http://blog.codeville.net/2008/04/30/model-based-client-side-validation-for-aspnet-mvc/. If you are using MVC 2, using DataAnnotations, which has the option of validating on client side.

Resources