Placehloder and Usercontrol

RSA

Member
Joined
Dec 13, 2004
Messages
8
Programming Experience
Beginner
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?
 

TPM

Well-known member
Joined
Dec 7, 2004
Messages
623
Location
CA
Programming Experience
3-5
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.

TPM

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

RSA

Member
Joined
Dec 13, 2004
Messages
8
Programming Experience
Beginner
Hi TMP,

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:

on_load
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.
 

TPM

Well-known member
Joined
Dec 7, 2004
Messages
623
Location
CA
Programming Experience
3-5
Right that's because the onload is firing and loading the defauld ascx. You need an if ispostback, or an if session("whatever") = whatever
 
Top Bottom