• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 670
  • Last Modified:

Usercontrols Not Showing

Under ASP.NET v1.1 we've created a web application which contains a single user control (main.ascx).  The usercontrol is composed of a single ASP:placeholder.  This control executes code to dynamically load other user controls (via LoadControl) and makes use of reflection to obtain the parameters of their respective class.  Once the dynamicly loaded user control is read in, it is added to the ASP:placeholder to be shown on screen.  

The problem we're facing is on Postback the dynamically loaded controls aren't be reshown on screen.  The same code is executing (similar to the first time through) but this time the web page is blank.  Steping thru the code after postback I can see the ASP:placeholder contains the dynamically loaded user control.

Also, each dynamically loaded user control contains event handlers for button clicks on buttons contained within the user control page.  These events are never called on clicking the buttons -- there is a post back, which calls the original default.aspx page and the main.ascx control.

Am i working with placeholders, controls, and postbacks incorrectly?
1 Solution
Every dynamic loaded objects you must load on every postback (Page_init, Page_load event handlers), not only on first load of Page.

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now