1

Apologies if this is forgetful late-night coding, but....

I've got some dynamically populated DropDownList controls that are being added to a panel at runtime. I've had the panel with and without explicitly enabling its viewstate.

If I declare and populate them inside the usual

if (!Page.IsPostBack)

block in the Page_Load then they simply don't exist on Postback - I try to iterate through the panel's controls collection and it's empty.

If I declare and populate them separately in the page's OnInit then they exist, but lose their values.

How do I get them to both exist and retain their values?

4

0 回答 0