views:

205

answers:

2

I have multiple UpdatePanels on a page, each filled by somewhat expensive controls. On async postbacks, all UpdatePanels are initialized, but only the updates UpdatePanel is sent to the client. Now I would like to initialize only the UpdatePanel that actually requires an update.

http://ryanfarley.com/blog/archive/2005/03/11/1886.aspx suggests decoding the __EVENTTARGET parameter to find the control that caused the post back. forums.asp.net/p/1385862/2947336.aspx suggests decoding the Request.Form value corresponding the the ScriptManager unique ID. Both seems to work fine. However, our production system (IIS 6, .NET 3.5) frequently reports requests where __EVENTTARGET is set to the unique ID of the ScriptManager (MyScriptManager). In these cases the ScriptManager parameter also decodes to MyScriptManager|MyScriptManager instead of UpdatePanelId|EventTargetId.

It has been observed for Firefox 3.0 and 3.5 as well as IE 6, 7 and 8. However, I was unable to reproduce it. Does anyone have a hint what causes our clients' browsers to post back these values?

A: 

Have you tried setting the updatepanel's updatemode to "conditional" ? I think this would solve your problem.

More information here: http://codeclimber.net.nz/archive/2007/05/24/updatemode-default-value-for-the-updatepanel-is-always.aspx

mga911
I already use UpdateMode.Conditional. However, this seems to have only two effects: Only the content of updated updatepanels is sent to the browser, and the protected property UpdatePanel.RequiresUpdate is initialized before the OnPreRender event. However, I want to omit creating the child controls of the UpdatePanel, which happens before (OnInit/OnLoad). Therefore I try to predict which updatepanels later decide that they require an update.
Malte Clasen
A: 

The ASP.NET AJAX history state causes this kind of requests. When a client uses our web application, we track the partial page updates using EnableHistory="true" on the ScriptManager. If the client clicks the back button in her browser, the ScriptManager initiates an asynchronous request, using itself as EventTarget.

Malte Clasen