ive developed a Dual List composite control which contains 2 listboxes so you can swap items between them. it works beautifully...or at least i thought it did until today!
the problem i encountered was when i set a different datasource for my listboxes. basically, i have a dropdownlist on my page which auto posts back. in the event handler i clear my listboxes and rebind them to a different data source. this seems ok. but if my page then posts back the listboxes are losing their state.
i have figured out that it is viewstate causing this problem. i am rebinding my Dual List in the dropdownlist SelectedIndexChanged event handler. but i think this has fired after the ViewState has been set. so I have a situation where I have one set of data in my lists and another in my ViewState. so when I post back it is emptying my lists. I am not sure if I need to override LoadViewState, SaveViewState or TrackViewState to solve this. any help very very much appreciated as I am nearing a deadline! :(
p.s. at the moment my composite control does its stuff in OnLoad.