cross posts will least likely end up with answered questions.
--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/27cok
"Mike Towle" <> wrote in message
news:C46C4561-A933-4AF0-A229-...
> Trying to create controls in a button.click event, not the Page_Init
> event. All examples of code I have found so far creates the controls and
> binds them to their container (form, placeholder, etc) in the Page_Init
> event. But if I try to create and bind a control in the button.click
> event, when the page refreshes I cannot remove / destroy the control. And
> if I reuse a dropdownlist control that was dynamically created in the
> button.click event then I cannot clear the list of items at all either.
> All I can do is add to the items collection. Cannot destroy the control
> and start over or clear the list of items. I am creating different
> controls based on values in a database. The button.click event destroys
> any previously created controls, fetches the next record in the database,
> creates the control based on the values in the database, binds it to the
> form or placeholder, and sets the properties of the control. Another
> issue is that if I dynamically create a control in the button.click event
> and bind it to a container such as a form or placeholder then if I query
> the container's controls.count method then the count has not changed!