PlaceHolder control

  • Thread starter Thread starter Mr. M
  • Start date Start date
M

Mr. M

Hi!

I've a web page, in which users may add controls dinamically. So, every
times that users press a button, a DropDownList must be added to the page.

For these, i have add a PlaceHolder control, which contains all DropDownList
controls added by users.
These control, have EnabledViewState property set to true, but every times a
round trip occurs (data goes to server and back), this control lose all
DropDownList controls list, that users were add.
In the same way, when a page was submitted to the server, the
PlaceHolder.Controls.Count property returns 0 value.


Any suggestions???
Thanks.
M.-
 
Hi,

do you add the controls to the PlaceHolder on postback as well? ViewState
restores only the state of the controls, not control instances themselves
and therefore dynamic controls need to be added on every request for them to
be in the Controls collection.
 
Teemu, thanks for your response...

But if i need to create a new Control instance and add it to the Controls
collection, on every request.
When a page is submitted to the server,
How can i access to the SelectedValue property of the DropDownList?
(because the Controls.Count is 0)
 

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