ASP.NET Tip: If your DropDownList items are lost on postback

This might seem obvious but it had me stumped for a while. Most ASP.NET programmers should know that if you set EnableViewState to false on a DropDownList, the items that were bound to that control will not be persisted on postback. What you might forget (as I did) is that if your DropDownList (or any other DataBound control for that matter) is held within another control (such as a Panel) that has viewstate disabled, then it also applied to anything contained within that control.

I added a DevExpress Panel to my MasterPage surrounding a ContentHolder, then wondered why none of my DropdownLists were working correctly.

Mental note to myself this one….