The project is for ASP.NET with a VB server side script.
I have a dropdownlist that fills itself up from a datasource. It posts back with other queries, but problem is that the selected item on the dropdownlist resents to what's on its index 0.
Is there any way that I can retain the value selected after postbacK?
Here's some code:
> Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
> If Not IsPostBack Then
> Dim qs = Request.QueryString.GetKey(0)
> Dim po As New ProductObj
> Select Case qs
> Case "br"
> Dim x = Request.QueryString("br")
> Dim y = Request.QueryString("c")
> po.GetCategories(ddlasdf, x)
> Case "ca"
> Dim y = Request.QueryString("ca")
> Dim x = Request.QueryString("b")
> po.GetBrands(ddlasdf, y)
> End Select
> End If
> End Sub
>
> Protected Sub ddlasdf_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ddlasdf.SelectedIndexChanged
> Dim qs1 = Request.QueryString(0)
> Dim qs2 = Request.QueryString.GetKey(0)
> MsgBox(ddlasdf.SelectedItem.Text)
> Select Case qs2
> Case "br"
> Response.Redirect("List.aspx?br=" & qs1 & "&c=" & ddlasdf.Text)
> Case "ca"
> Response.Redirect("List.aspx?ca=" & qs1 & "&b=" & ddlasdf.Text)
> End Select
>
> End Sub
Thanks in Advance.
Answer:
So I solved it myself. Just got the query string index 1 and put it as the text attribute for ddlasdf on page load, inside !IsPostBack. Thanks everyone.
So I solved it myself. Just got the query string index 1 and put it as the text attribute for ddlasdf on page load, inside !IsPostBack. Thanks everyone.