I have a dropdown box that gets populated in .net. when the user changes the index, a query is run and the corresponding data for the order is shown.
here is the code for the dropdown box getting changed.
Basically everything works fine, but the top result in the box cant be clicked on, unless another value is clicked on first. I could just stick this code somewhere else on the page to run when the box is filled initially, but i dont want to. Is there anyway that I can make the top item in the drop down box clickable the first time the user selects it?
here is the code for the dropdown box getting changed.
Private Sub ddorder_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ddorder.SelectedIndexChanged
Try
Dim temp = ddorder.SelectedValue.ToString()
Convert.ToInt32(temp)
Dim Sql As String
Dim Cmd As OleDb.OleDbCommand
Dim Reader As OleDb.OleDbDataReader
Dim Con = New OleDb.OleDbConnection("SERVER INFO EDITED OUT")
' queries the database
Sql = "Select * from ORDERS WHERE Order_no = '" & temp & "'"
Cmd = New OleDb.OleDbCommand(Sql, Con)
Con.Open()
'converts the table to text
Reader = Cmd.ExecuteReader(CommandBehavior.CloseConnection)
If Reader.Read() Then
txtcustno.Text = Reader(0).ToString
txtfname.Text = Reader(1).ToString
txtlname.Text = Reader(2).ToString
txtcomp.Text = Reader(3).ToString
txtaddress.Text = Reader(4).ToString
txtcity.Text = Reader(5).ToString
txtstate.Text = Reader(6).ToString
End If ' end of reader loop
Con.Close()
Catch ex As Exception
lblstatus.Text = ex.Message
End Try
End Sub
Basically everything works fine, but the top result in the box cant be clicked on, unless another value is clicked on first. I could just stick this code somewhere else on the page to run when the box is filled initially, but i dont want to. Is there anyway that I can make the top item in the drop down box clickable the first time the user selects it?