Click to See Complete Forum and Search --> : DropDownList is losing state when using an UpdatePanel


Yovav
November 30th, 2008, 04:59 PM
Dear Gurus,

I have an UpdatePanel with a DropDownList
(AutoPostBack="true")

Its being triggered in the UpdatePanel like this
<AJAX:AsyncPostBackTriggerControlID="_benefitGroup"EventName="SelectedIndexChanged"/>

The problem is that every refresh to the page causes the drop down to lose it's state,

How can I make it remember the last selection state without using the session ?

(what is wrong with the ViewState / UpdatePanel ?)

wildfrog
December 1st, 2008, 06:21 PM
It depends on how you fill your drop down list with data. Try avoid changing the drop down during postbacks:

If (Not Page.IsPostBack) Then
DropDownList1.Items.Add("a")
DropDownList1.Items.Add("b")
DropDownList1.Items.Add("c")
DropDownList1.Items.Add("d")
End If

- petter