Monday, March 26, 2012

Determining the source of a partial rendering postback

Is there a way to determine (on the server) what trigger/control/event was the source of the postback? How about something that indicates what update panel(s) will be rendered?

I see that the script manager has an IsInAsyncPostBack property, but I'm curious if there is something more specific.

UpdatePanel.IsInPartialRendering does not seem to work.

You could check the _EventTarget for a hint on what triggered the PostBack.

What would you do differently if you knew what triggered the PostBack?


You could use the ScriptManager.AsyncPostBackSourceElementID to determine the source of the asynchronous postback. In terms of what UpdatePanels will get updated, in server code I don't think there is a summary list that lists them because the Update() method can be called by any code and tracking that is difficult if not impossible(?). However, on the client you can use the pageLoaded or pageLoading events of the PageRequestManager to get information about what panels will be created, updated or deleted.

No comments:

Post a Comment