UpdatePanel 实际上是如何工作的?

发布于 2024-07-15 00:35:42 字数 158 浏览 6 评论 0原文

触发更新时会更新什么? 什么会发送到服务器? 什么回来了?

我的印象是,只有面板的内容被传输到服务器并返回(没有触及面板之外页面中的任何内容),但我遇到了奇怪的结果,可能是因为我不太明白它是如何工作的确切地。

有人可以简单地解释一下它到底是如何工作的吗?

What is updated when an Update is triggered? What goes to the server? What comes back?

I was under the impression that only the content of the panel was transmitted to the server and back (without touching anything in the page outside the panel), but I'm experiencing strange results, probably because I don't really understand how it works exactly.

Can someone provide an easy explanation as to how exactly it works?

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

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

发布评论

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

评论(2

君勿笑 2024-07-22 00:35:42

发送到服务器的帖子几乎包含帖子的所有信息,包括视图状态。 区别在于实际返回给浏览器的内容。
为了处理请求,整个页面被实例化,如果在更新面板之外更新了任何内容,那么您可能会收到一些丑陋的错误。

更新1:这与其他ajax方法不同,它只发送所需的信息,不使用viewstate,即ajax控制工具包的autocompleteextender - 查找json、ajax请求和其他相关信息。

它可能对您有用,但您正确地了解正在发生的事情,这样您就需要什么时候它适合其他解决方案。

The post that goes to the server contains pretty much all the information of the post, including the viewstate. The difference is on what is actually returned back to the browser.
To process the request, the full page is instantiated, if anything is updated outside the update panel, then you can get some ugly errors.

Update 1: this is different to other ajax approaches, that only send the bit of info needed and doesn't use viewstate i.e. autocompleteextender of the ajax control toolkit - look for json, ajax requests, and other related info.

It might work for you, but you are correct to look into understanding what is going on, that way you need when it is appropriate to just other solutions instead.

海的爱人是光 2024-07-22 00:35:42

生成的是通过 AJAX 提交的表单,这本质上意味着浏览器中的 XML HTTP。 当它到达服务器时,服务器将其视为 AJAX 调用,并将请求路由到正确的方法。

至于确切发送的内容,它是表单提交应该发送的任何内容,很可能是 UpdatePanel 之外的信息。 然后服务器找出要处理的内容并发回响应。

作为理论,这一切都很好,但你处理的是问题而不是理论。 你正在经历什么奇怪的事情? 如果您可以发帖,我们可以重点关注问题的细节。

What is generated is a form submit through AJAX, which means essentially XML HTTP in the browser. When it hits the server, the server sees it as an AJAX call and it routes the Request to the correct method.

As for precisely what is sent, it is anything that the form submit should send, which can very well be information outside of the UpdatePanel. the sever then figures out what to work with and sends back a Response.

This is all well and good as theory, but you are dealing with problems not theory. What strangeness are you experiencing? If you can post, we can focus on the particulars of the problem.

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