Placeholder's controls disappear during postback

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi, I have a PlaceHolder on a place, to which I add a DropDownList (using
myPlaceHolder.Controls.Add(ddl). The user selects something from the
DropDownList and posts the page.

Now I try to get the value of what the user selected but the PlaceHolder's
Controls collection is empty. I've tried turning viewstate of the PlaceHolder
on and off but it doesn't make a difference (and I think I should be able to
leave it off).

What could be causing the PlaceHolder's controls to disappear? Shouldn't
they be carried with the form post?

Thanks.
 
If you are setting them up in your Page_Load based on certain events, you may
simply not be setting them up when it is a postback. If so, refactor to avoid
having them reset with postback.

---

Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA

***************************
Think Outside the Box!
***************************
 

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

Back
Top