difference between jquery validate plugin and ASP.NET MVC data annotations? - asp.net-mvc

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.

Related

Difference between jQuery Validation and Microsoft jQuery Unobtrusive

What's the difference between the nugget packages Jquery Validation and Microsoft Jquery Unobtrusive when using them for validation?
jQuery Validation is just a javascript plugin used by Microsoft through its custom javascript named Microsoft jQuery Unobstrusive plugin to make ASP.Net MVC validation on client side a quiet simple.
jQuery Validation by definition (source https://jqueryvalidation.org/) :
This jQuery plugin makes simple clientside form validation easy,
whilst still offering plenty of customization options. It makes a good
choice if you’re building something new from scratch, but also when
you’re trying to integrate something into an existing application with
lots of existing markup. The plugin comes bundled with a useful set of
validation methods, including URL and email validation, while
providing an API to write your own methods.
Microsoft jQuery Unobstrusive need and works upon jQuery Validation. When you're using ASP.Net Validation like decorating your model with some data annotations attributes (Required, EmailAddress, etc), ASP.Net MVC generates some data-* attribute on fields that are related to your model. Microsoft jQuery Unobstrusive use those data-* and make your developer life easy so you don't need to code all thoses things describe in the jQuery Validation vidéo. That is why the Unobstrusive word is on Microsoft jQuery Unobstrusive. Go to this link to learn more about Unobstrusive Javascript

asp.net mvc 2: Overriding client validation so i can use jquery effects?

is there a way to override client validation so i can use jquery?
Currently i am using attributes on my model, a new feature of mvc 2
Thanks in advance
This is included in MVC futures.
Look in \mvc2-rtm-sources\src\MvcFuturesFiles\MicrosoftMvcRemoteValidation.js
check out the xVal project: http://xval.codeplex.com/
I think by default it's wired up to use jQuery validation, but you can substitute your own validation logic if you want.

Quickest way to add a DataGrid to an MVC.NET app: ASP.NET AJAX or jQuery?

I have an ASP.NET MVC application which uses plain HTML. I quickly need to add tabs and a datagrid to it. I've been evaluating ASP.NET AJAX and jQuery, but am running out of time to make a decision.
If I needed to add these 2 features quickly, how should I proceed? ASP.NET AJAX or jQuery?
If you are adding a grid to MVC, your best bet is JQuery. The ASP.NET DataGrid is not going to work with MVC, because MVC doesn't support postbacks. The ASP.NET AJAX tabs may not work either.
Here is a plugin for the tabs:
http://stilbuero.de/jquery/tabs_3/
And here is a plugin for the Grid:
http://www.trirand.com/blog/
If you want to roll-your-own server-side GridView control for MVC, see here:
http://stephenwalther.com/blog/archive/2008/06/25/asp-net-mvc-tip-9-create-a-gridview-view-user-control.aspx
There is also a Grid Component in MVCContrib:
http://mvccontrib.codeplex.com/Wiki/View.aspx?title=Grid&referringTitle=Home
jQuery UI Extensions for ASP.NET MVC contains tabs:
http://jmvcui.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=33636

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.

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

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.

Resources