Why ASP.NET MVC 2 will have its own client-side validation? - asp.net-mvc

I am interested what are possible reasons that ASP.NET MVC 2 will have its own client-side validation instead of merging with xVal validation framework? Has someone from ASP.NET MVC team blogged about it?

They are providing a way to plug in some other library for client-side validation.
Haacked blog:
Client-Side Validation – ASP.NET MVC 2 includes the jQuery validation library to provide client-side validation based on the model’s validation metadata. It is possible to hook in alternative client-side validation libraries by writing an adapter which adapts the client library to the JSON metadata in a manner similar to the xVal validation framework.

Related

React.js mixed with asp.net MVC for validation

I am an experienced .net developer and I am very competent using MVC. I have only just read up a little on react.js today and would like to try and get more into it.
Are there any .net MVC developers or there that have mixed a project up with MVC with good results? Most notably to do with validation.
Normally my C# classes have validation attributes on them. And I can mess around with model state errors to do more custom stuff server side.
How would you mix react validation with MVC? Or can it not be done?
EDIT
Is there anyway to validate in React using the MVC attributes to save duplication of validation?
I would recommend having your validation rules server-side, then passing a json object to the client with those validation rules. On the client, you can then create logic to validate these rules, and then once the form is submitted you can run the server-side validation rules and pass back any failed validation to the client.

NHibernate Validator and ASP.NET MVC 4

We're looking at upgrading a large-scale project currently implemented using ASP.NET MVC 2 with xVal providing the glue between NHibernate Validator and client-side validation.
When I was looking for resources on using the new "unobtrusive" client side validation used in MVC 3/4 with NHibernate Validator, I was only able to locate a single (and nearly 3 year-old) blog post about this.
Has anyone successfully used NHibernate Validator for client-side validation in MVC 3/4? If so, what has your experience been?
Although I don't have any experience directly with NHibernate, FluentValidation (a validation framework worth considering itself) has an MVC 3/4 adapter extension project which would serve as an excellent guide to creating an NHibernate Validator implementation.
So, i've never used NHibernate Validator, but consider to, because NHibernate Validator has a better perfomance than native MVC unobtrusive validator(MVC validator is totaly based on reflection, in case of NHibernate Validator reflection work happens at startup only).
In case of a large-scale project, i think it is better way.

difference between jquery validate plugin and ASP.NET MVC data annotations?

I am wondering what is the difference between validating Controls using JQuery Validate plugin and ASP.NET MVC DataAnnotations?
Appreciate your responses.
Thanks!
JQuery Validate is a JQuery plugin for client side validations.
Up until MVC2 all the unobstruive ajax and validation targated ASP.NET AJAX library. but in asp.net MVC3 unobstruive ajax and validation targets JQuery and JQuery validate plugin.
see this video http://channel9.msdn.com/Series/mvcConf/mvcConf-2011-Brad-Wilson-Advanced-MVC-3 by Brad Wilson where he talks about custom unbostruive validations.
ASP.NET MVC DataAnnotations is a best way to validate your controls as they can validate your inputs to client side and server side as well.
In MVC 3 you can also use RemoteAttribute to send a remote call to an action method.

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.

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