Question : Keeping dropdown list state

I have a simple dropdown list which if selected, I have a selected index changes action to redirect the page back on itself with a request variable.
My problem is that once I have selected the value and the page has redirect and performed any relevant functions the  dropdown list goes back to its defaul value, How do I keep the value selected. (is this view state that I have been hearing about?). Should be a simple one as I'm sure people do it all the time.
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:

£0
£20
£40
£60
£80
£100
£120
£140
 


===== on selected index changed ==== 
Response.Redirect(CurrentPage.SessionField = "?MinPrice=" + DropDownList1.SelectedValue )

Answer : Keeping dropdown list state

Then you will need to save the selected value in a Session variable before you redirect. Then in your page_Load, you retrieve the value from the Session variable and assign to the DDL so it will keep the selected state.

add this line before Response.Redirect:
Session("SelectedValue") = DropDownList1.SelectedValue

Then in your Page_Load do this:
If (Session("SelectedValue") IsNot Nothing) Then
   DropDownList1.SelectedValue = Session("SelectedValue").ToString()
   Session.Remove("SelectedValue")
End If
Random Solutions  
 
programming4us programming4us