By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,948 Members | 1,484 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,948 IT Pros & Developers. It's quick & easy.

Postback on Controls added to placeholder

P: n/a
I have added controls to the placeholder control. All the controls that were added have EnableViewState = true including the placeholder. One of the controls has a button that performs a postback. My question is when the button is clicked and a postback is performed, the controls that were in the placeholder no longer appears on the screen! Am I doing something wrong here? Why are the controls back on the screen eventhough they have enable view state

I am doing this rather than creating a Composite control for certain reasons. I just would like to know why adding controls in code to the placeholder no longer appears when a postback is performed

Thanks....
Nov 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
You have to recreate the controls when the page posts back.

Enabling viewstate will enable the controls to wire themselves back up when
they are added to the control tree again. If you set any of the properties
of the child controls before adding them to the placeholder, you will need
to set them up again before adding to placeholder. If you added the
controls to the placeholder before changing any of the properties, the set
values will appear simply by adding the control with the same ID to the
placeholder on your postback. Then any events will fire such as button
clicks, or text changed events.

HTH,

bill

"Angel" <an*******@discussions.microsoft.com> wrote in message
news:BD**********************************@microsof t.com...
I have added controls to the placeholder control. All the controls that were added have EnableViewState = true including the placeholder. One of the
controls has a button that performs a postback. My question is when the
button is clicked and a postback is performed, the controls that were in the
placeholder no longer appears on the screen! Am I doing something wrong
here? Why are the controls back on the screen eventhough they have enable
view state?
I am doing this rather than creating a Composite control for certain reasons. I just would like to know why adding controls in code to the
placeholder no longer appears when a postback is performed?
Thanks....

Nov 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.