Drop down list value remain selected even after submit button click

wonder_gal

Active member
Joined
Jun 5, 2006
Messages
34
Programming Experience
1-3
Hi,

I have 2 drop down lists and 1 submit button. It works such that after the user has selected values from BOTH the drop down lists, then the user will click a "Search" button. My problem is, after the user click the "Search" button, the second drop down list is no longer displayed with the selected value, instead it displayed a default value. May I know how can I make sure the selected value remain selected even after the user clicks the "Search" button on the page?

For your info, my coding goes as

VB.NET:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim strSelectedUsername As String

        If Not IsPostBack() Then
            Populate1stDropDownList()
        End If

        Populate2ndDropDownList()

    End Sub

Private Sub Populate1stDropDownList()
        Dim strSQL As String

        strSQL = "SELECT XXX"
        selCompanyName.DataSource = XXX
        selCompanyName.DataTextField = XXX
        selCompanyName.DataBind()
    End Sub

    Public Sub Populate2ndDropDownList()
        Dim strSQL As String

        strSQL = "SELECT XXX"
        selUsername.DataSource = XXX
        selUsername.DataTextField = XXX
        selUsername.DataBind()
    End Sub

Can someone kindly help?
 
Last edited:
Back
Top