是否有一个理由,preFER jQuery.Ajax到ASP.NET的UpdatePanel? [英] Is there a reason to prefer jQuery.Ajax to asp.net UpdatePanel?

查看:142
本文介绍了是否有一个理由,preFER jQuery.Ajax到ASP.NET的UpdatePanel?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我开发一个应用程序asp.Net,才会有一些情况下,我应该忘记MS的Ajax的UpdatePanel和preFER jQuery.Ajax来更新我的网页的某一部分?

If I am developing an asp.Net application, can there be some cases where I should forget about MS Ajax UpdatePanels and prefer jQuery.Ajax to update some part of my page?

感谢您

推荐答案

是的,事实上,你应该的总是 preFER之前使用自己(或jQuery的)Ajax功能。

Yes, in fact, you should almost always prefer using your own (or jQuery's) ajax functionality before.

有是的很多的与MS的Ajax的UpdatePanel相关联的开销(它执行一个完整的回传,然后更新改变了页面上的元素(S)),所以在一个很好的特性支持AJAX网站 - responsivenes,连续性等 - 几乎完全丧失(恕我直言)。你有什么是在电缆实际提交的返回什么,很难控制,以及它是如何在返回给客户端处理。

There is a lot of overhead associated with the MS Ajax UpdatePanel (it performs a full postback, and then updates the element(s) that changed on the page), so the nice features in an AJAX enabled web site - responsivenes, continuity etc - are almost entirely lost (IMHO). You have very little control of what is actually submitted over the cable, of what is returned, and of how it is treated upon return to the client.

使用jQuery阿贾克斯在另一方面,你得到充分的和即时的控制,可以使光量(或重)请求如你所愿,并让我们面对它 - API是不以任何方式使用难度比的UpdatePanel的。

With jQuery Ajax on the other hand, you get full and instant control, you can make as light-weight (or heavy) requests as you wish, and lets face it - the API isn't in any way harder to use than that of the UpdatePanel.

考虑到这一点,仍然存在的情况时的UpdatePanel是罚款,甚至更好。尤其是在ASP.NET的WebForms,它可能会非常棘手的,如果用户无法使用的JavaScript缓慢下降的方式只返回页面的一部分,并为快速拖 - 放的发展风格,真的是有没有办法的jQuery可以竞争。 (不管你喜欢拖和拖放开发或不完全是其他的讨论......)

With that in mind, there are still scenarios when the UpdatePanel is fine, or even better. Especially in ASP.NET WebForms, it can be tricky to return just part of a page in a way that gracefully degrades if the user can't use javascript, and for the rapid "drag-and-drop" development style, there is really no way jQuery can compete. (Whether you like drag-and-drop development or not is an entirely other discussion...)

这篇关于是否有一个理由,preFER jQuery.Ajax到ASP.NET的UpdatePanel?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆