469,902 Members | 1,978 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,902 developers. It's quick & easy.

Postback on Controls added to placeholder

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
1 5214
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.

Similar topics

9 posts views Thread by wASP | last post: by
13 posts views Thread by Chris Thunell | last post: by
1 post views Thread by John Cosmas | last post: by
reply views Thread by Jeff User | last post: by
CroCrew
2 posts views Thread by CroCrew | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.