views:

41

answers:

3

What better to use in ASP.NET MVC 2: - Ajax-forms created with the AjaxHelper class or - jQuery ajax?

I think it's a little more straightforward to use the AjaxHelper, but I don't know if it's a good practice to have many forms on the page (AjaxHelper creates a form, whereas the jquery doesn't).

+3  A: 

Short answer: jQuery AJAX. Why? Unobtrusive, better separation of markup and script, keep the markup clean, preserve bandwidth, infinity of plugins, better documentation, ...

If you are concerned about ajaxifying your forms I would recommend you the excellent jQuery.form plugin.

After realizing their mistake, Microsoft started putting efforts into jQuery and in my opinion a day will come when they will deprecate their library (well not before deprecating classic WebForms as the UpdatePanel depends on it).

Darin Dimitrov
+1  A: 

It depends on the situation. The main advantages with using Microsoft Ajax is that it degrades gracefully with accessibility constraints, works well with MVC's validation and doesn't require any actual script writing.

jQuery gives you much more control so is much more maintainable. Microsoft are now ploughing lots of resource into jQuery and I imagine they aren't putting so much effort into Microsoft Ajax. I would always tend to use jQuery unless there was a good reason not to.

With regards to your forms question, place as many forms on your page as make functional sense. Sadly ASP.NET Webforms have made people reluctant to use multiple forms.

David Neale
A: 

I prefer the jQuery forms plugin as it offers a lot of client side flexibility and is a native "client side" framework. The AjaxHelpers feel like the wrong place to be trying to setup Ajax interactions and ultimately leads to poor separation.

lomaxx