UpdatePanel是如何工作的呢?

时间:2023-01-09 19:44:15

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?

有人能简单地解释它是如何工作的吗?

2 个解决方案

#1


2  

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.

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

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.

对于所发送的内容,它是表单应该发送的任何内容,很可能是UpdatePanel之外的信息。然后服务器找出要处理的对象,并返回一个响应。

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.

这和理论是一样的,但是你是在处理问题而不是理论。你经历过什么奇怪的事情?如果你能发表文章,我们可以关注问题的细节。

#2


2  

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.

发送到服务器的post包含了几乎所有的post信息,包括viewstate。不同之处在于返回给浏览器的内容。为了处理请求,整个页面被实例化,如果在更新面板外部更新了任何东西,那么您就可以得到一些难看的错误。

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.

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

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.

它可能对你有用,但你要正确地去理解正在发生的事情,这样你需要的是,当它适合于其他的解决方案时。

#1


2  

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.

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

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.

对于所发送的内容,它是表单应该发送的任何内容,很可能是UpdatePanel之外的信息。然后服务器找出要处理的对象,并返回一个响应。

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.

这和理论是一样的,但是你是在处理问题而不是理论。你经历过什么奇怪的事情?如果你能发表文章,我们可以关注问题的细节。

#2


2  

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.

发送到服务器的post包含了几乎所有的post信息,包括viewstate。不同之处在于返回给浏览器的内容。为了处理请求,整个页面被实例化,如果在更新面板外部更新了任何东西,那么您就可以得到一些难看的错误。

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.

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

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.

它可能对你有用,但你要正确地去理解正在发生的事情,这样你需要的是,当它适合于其他的解决方案时。