PlaceHolder Issue

  • Thread starter Amir Ghezelbash
  • Start date
A

Amir Ghezelbash

Hey every body;

first off let me say thanks every body..this place is great i have never
came here with a problem and left without an answer..you guys are awsome

any way i had a question rather a problem then a question

i am using a placeholder control in my webform this control
programmically loads up a custom control, the control that it loads up
is a asp.net 2.0 wizard...now here is aproblem,
the control loads up no problem, but the issue is that once the the next
button has been clicked on the wizard and the page refreshes, the
control goes away. i think the place holder unloads the control for
somereason....so the user will never get to step 2 of the wizard....

any suggestion why is this happneing and how can i pervent it ?

thanks in advance
 
K

Karl Seguin

Amir:
Dynamically added controls aren't automatically reloaded on postback.
Viewstate only holds control information, not the actual control itself.
You need to reload the control...and in order for it's event to fire
properly, you need to do it pretty early in the page lifecycle..typically on
onInit, but I think onLoad will work also. Oftentimes, people will put an
array of strings in the viewstate (which contain a list of dynamically added
controls), on postback retrieve the list of strings from viewstate and
reload the controls.

As an alternative, you can use Denis Bauer's Free Dynamic PlaceHolder
control which takes care of all this for you (ie, it recreates the controls
on postback)
http://www.denisbauer.com/ASPNETControls/DynamicControlsPlaceholder.aspx

Karl
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,611
Members
45,268
Latest member
AshliMacin

Latest Threads

Top