AI OnAI Off
This is classic .NET and related to the Page Lifecycle - to fully understand read this article: http://aspnet.4guysfromrolla.com/articles/092904-1.aspx
In short: you need to add your items before ViewState is loaded - use the OnInit method (and you need to add the items also on postbacks).
Mari! Got it sorted, can't believe I overlooked this!
Much appreciated, tusen takk
Hi guys,
Basically what I want to do is in my advanced search I'm wanting to be able to search by section, where the user will be able to specify which section to search using a dropdown list.
If I hard code the listitems the search works fine. However, this isn't ideal. I can initally populate the dropdown with the desired items (if !IsPostBack), however when the page is posted, the list empties and doesn't search within the chosen selection.
I've set EnableViewstate to true in the masterpages, and the page itself, but it makes no difference.
If I have the dropdown populated on pageload, it again searches the root rather than the selected item.
Is there anything I'm missing? Its driving me mad!