Sunday, March 11, 2012

UpdatePanel Archiecture

Hi,

hew:


I been wondering how do they dynmaically updates server components UI settings


if you are talking about the ViewState, keep in mind that when an UpdatePanel performs its update, what is done is an asynchronous postback. This means that all the "state" (ViewState and other hidden fields) is posted to the server and the Page goes through its *whole* lifecycle.

What happens then is that only the HTML rendered by the controls inside the corresponding UpdatePanels is rendered and the old HTML is replaced by the new one.

How is it possible? Well, what happens on server side is that *all* controls are rendered, like in a normal postback, but only the controls inside an UpdatePanel are actually writing their HTML (via a HtmlTextWriter). The controls outside an UpdatePanel are rendering their HTML in a NullTextWriter, this is the reason why it isn't being sent in the response. This basically does the trick on server side.

On client side, a response is received after the postback is done, that contains some XML that is parsed to extract also the HTML written during the postback. What is done then is taking the DOM subtree corresponding to the UpdatePanel's client element and replacing its content with the new child nodes created from the rendering done on server side.

Hope things are a bit more clear now, though I know my response is very simplicistic (and sorry for that).

Btw, here's a couple of articles that may help you:

A post by Ben Rush
A post by Joel Rumerman

No comments:

Post a Comment