How do I disable viewstate for a specific control?

<asp:TextBox ID="TextBox1" runat="server" EnableViewState="false" /> <asp:Button ID="Button1" runat="server" Text="Button" /> I have set the EnableViewState property to false, but when I click on the button the value in the textbox persists after the postback. Why does the value persist? Answers: Thank you for visiting the Q&A section on Magenaut. Please note that all the answers … Read more

Dynamically created DropDownList loses ListItems on Postback

I have a page that contains some dynamically created controls (TextBox and DropDownList). When a postback occurs, the TextBoxes keep their values, but the DropDownLists lose their ListItems.
This is quite confusing, since the page level DropDownList also keeps its ListItems. Can anyone see what’s wrong with the code below?