ASP.NET - 如何让AJAX请求到服务器没有得到响应的信息全部更新面板我有吗? [英] ASP.NET - how to make AJAX request to the server without getting response with the information for all the update panels I have?

查看:92
本文介绍了ASP.NET - 如何让AJAX请求到服务器没有得到响应的信息全部更新面板我有吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

例如,我在页面的三个的UpdatePanel。我点击一个按钮,我得到pretty的长的响应,它包含三个的UpdatePanel的所有数据,视图状态的字符串。

For example, I have three UpdatePanels on the page. I click a button, and I get pretty long response, that contains all the data for the three UpdatePanels, the viewstate string.

我要优化我的查询和接收响应,如OK或不正常。我该怎么办呢?

I want to optimize my query and receive response like "ok" or "not ok". How can I do that?

推荐答案

简短的回答是,与MS Ajax和特别的UpdatePanel,你不能。

The short answer is that with MS Ajax and especially UpdatePanels, you can't.

详细的回答:

的UpdatePanel的核心是,他们做了充分的岗位,以及完整的页面生命周期运行的任何控制它们所包含的,他们都能够解析出效应初探那涉及的部分,以他们各自的视口页面,更新只是那些部分。

The core of UpdatePanels is that they do a full post, and the full page lifecycle runs for whatever controls they contain, and they are able to parse out the portions of the reponse that pertain to their individual viewports on the page and update just those portions.

可以显著通过关闭视图状态为不需要它控制减少的数据量。另一个技巧是设置面板的的UpdateMode 属性设置为条件,让所有的更新面板页面不涉及每一个岗位。如果是从一个面板张贴和响应只是更新该面板,那么就没有必要在其他面板传送有关的控制数据。

You can reduce the amount of data significantly by turning off ViewState for controls that don't need it. Another tip is to set the UpdateMode property of your Panels to "Conditional", so that all the update panels on the page aren't involved in every post. If you are posting from one panel and the response just updates that panel, then there is no need to transfer data about the controls in the other panels.

读到这里的更新面板提示和技巧,以获得更好的性能了出来。

Read here for Update Panel tips and tricks to get better performance out of them.

如果你真的想与你的帖子做的只是简单的信息,我想看看使用jQuery和AJAX /后的方法张贴到替代网页或Web服务。 MS阿贾克斯绕回发架构设计的,所以尽管它是非常convienent,你无法逃避它的开销很容易。

If you really want to do just simple messages with your posts, I would look at using jQuery and its ajax/post methods to post to alternate pages or webservices. MS Ajax is designed around the postback architecture though, so while it's very convienent, you can't escape the overhead of it easily.

这篇关于ASP.NET - 如何让AJAX请求到服务器没有得到响应的信息全部更新面板我有吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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