Placehloder and Usercontrol


Dec 13, 2004
Programming Experience
I currently load a (default.ascx) as a usercontrol into a placeholder on on_load of a page (Default.aspx). I then on_click of a button in (Default.aspx) load a new (login.ascx) page into the same placeholdere and remove the (default.ascx) from the placeholder. When I click any buttons on the (login.ascx) which now sits inside the (Default.aspx). page to fire a event the page reloads and the placeholder is subsituted with nothing.

Any ideas?
Sounds like you need to use a session state to keep track of which ascx needs to be loaded. But it's kinda hard to say without seeing any code.


P.S. FYI : This should have been posted in, not

Thanks for the reply. Unfortunately I dont have any of my code here now but will post it soon. Just as an example I am basically doing the following:

loading new default.ascx into defaultplaceholder1 on my default.aspx page.

I then have a button on the Default.aspx which replaces the current defaultplaceholder1 value with Createlogin.aspx.

This all works fine and the Createlogin page appears. The Createlogin.ascx page has a couple of textboxes and a button which writes the textbox values to a DB.

The problem is the Default.aspx reloads and replaces the defaultplaceholder with nothing and the event is never fired in the Createlogin.ascx page to write the values of the textboxes to the DB.

I have played around with enableviewstate and posback but none of these help.
Right that's because the onload is firing and loading the defauld ascx. You need an if ispostback, or an if session("whatever") = whatever