Several updates Panels and onload

I have a page with two dynamically loaded custom controls, each containing its own refresh bar. When loading custom controls, I run javascript which updates the css of the table cells.

ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "Load_RunScript()", true);

      

Both custom controls have a button, each triggering a postback and server side running JS to make some changes. The problem I am running into is when I click on a button on one of the user controls (Say UCtlA), the postback forces the dynamic controls of the user control that fire the onload script in the UCtlB, and also causes the page to run slow.

Since the UCs are in UpdatePanels, my understanding is that the UI should not be re-rendered on the back. Why is this happening and what is the solution?

0


a source to share


2 answers


UpdatePanels cause postbacks similar to page postbacks. To avoid unnecessary Pageload work, check the ScriptManager.IsInAsyncPostback property to detect UpdatePanel postbacks. Only controls in UpdatePanel that call Postback need to update their GUI.



0


a source


Add property UpdateMode = "Conditional" and possibly ChildAsTriggers = "false"

http://weblogs.asp.net/alessandro/archive/2008/01/30/reducing-updatepanel-bloat-by-utilizing-updatemode-quot-conditional-quot-and-childrenastriggers-quot-false-quot.aspx



To be honest, I'd say avoid UpdatePanels because they are dogs, especially nested UpdatePanels.

0


a source







All Articles