DropDownList is losing state when using an UpdatePanel
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 ?)
Re: DropDownList is losing state when using an UpdatePanel
It depends on how you fill your drop down list with data. Try avoid changing the drop down during postbacks:
Code:
If (Not Page.IsPostBack) Then
DropDownList1.Items.Add("a")
DropDownList1.Items.Add("b")
DropDownList1.Items.Add("c")
DropDownList1.Items.Add("d")
End If
- petter