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)
 
Back
Top