开发者

ASP.NET MVC 2 AJAX vs. jQuery

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开发者_如何学Go jquery doesn't).


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).


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜