并发异步回调

发布于 2024-08-23 00:12:50 字数 427 浏览 4 评论 0原文

向asp.net专家提问。我花了很多时间试图找到答案或自己做,但到目前为止还没有运气。

ASP.NET Web 应用程序。我计划改善页面加载时间,以便更好的用户体验。我想使用 UpdatePanels 延迟加载页面的各个部分。我可以使用定时器以最小间隔在页面加载后立即更新一个 UpdatePanel 。这工作得很好,但是当尝试使用多个 UpdatePanel 完成它时,步骤就开始了。基本上发生的情况是所有面板都按顺序更新,而不是同时更新。

现在,我读到这是由于每个异步回发结果都带有整页视图状态,并且为了防止视图状态不一致,异步回发被序列化。实际上他们说只有最后一次回调才会成功,所以我猜我很幸运能将它们序列化。

现在最大的问题是:有人找到解决办法吗?如果可能的话,在 ASP.NET 中。这将是一个非常有价值的答案,可能不仅对我而言。

谢谢,谢谢,谢谢(工作答案:-)

Question to die hard asp.net experts. I have spent much time trying to find an answer or to do it myself but no luck so far.

ASP.NET web application. I plan to improve page load time so that user experience is better. I want to delay load sections of page using UpdatePanels. I can make one UpdatePanel update itself right after page loads using timer with minimum interval. That works just fine but steps begin when trying to have it done with multiple UpdatePanels. Basically what happens is all panels are updated but sequentially rather than all at the same time.

Now, I have read that this is due to a fact that each async postback result caries full page viewstate and to prevent from viewstate inconsistencies asynchronous postbacks are serialized. Actually they say that only last callback would be successful so I am lucky to have them serialized, I guess.

And now the big question: has anyone found a way round it? In ASP.NET if possible. This would be a VERY valued answer probably not only for me.

Thanks, thanks, thanks (for working answer :-)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

初懵 2024-08-30 00:12:50

UpdatePanel 在设计上是同步的。

如果要同时执行多个请求,则需要使用页面方法、AJAX 服务或原始 AJAX。无论哪种方式都意味着放弃 ViewState。

如果要针对多个 AJAX 请求同时呈现 ASP.Net 控件,您可以制作包含控件的小型独立 ASPX 文件,向它们发送 AJAX 请求,并将呈现的 HTML 插入到 DOM 中。在 jQuery 中,您可以像这样执行此操作:$('selector').load('something.aspx')。请注意,回发和视图状态都不起作用。

UpdatePanels are synchronous by design.

If you want to execute multiple requests concurrently, you'll need to use page methods, AJAX services, or raw AJAX. Either way means giving up on ViewState.

If you want to render ASP.Net controls concurrently for multiple AJAX requests, you can make small independent ASPX files that contain the controls, send AJAX requests to them, and insert the rendered HTML into the DOM. In jQuery, you would do this like this: $('selector').load('something.aspx'). Note that neither postbacks nor viewstate would work.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文