The first record in the Drop Down List doesn't populate at all... Please help....I should explain a little better
Here is a snippett from both pages the user selects the item in the drop down menu then they are rerouted to another page than takes that value and populates the textboxes
Private Sub DropDownList1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
Dim mystring As String = DropDownList1.SelectedItem.Text
'passing the variable to the next page
Response.Redirect("WebForm2.aspx?mystring=" & DropDownList1.SelectedValue)
End Sub
' this is the second page where it takes that variable and populates the textboxes
'then I am populating the texboxes based on the selectedtext in a fillbox() function
Sub fillBox()
Dim ds As New DataSet
Dim myCommand As OleDbDataAdapter
Dim smyString As String
'retreiving the variable passed from page 1 using the drop down list
smyString = Request.QueryString("mystring")
'code ot take out an apapostrophe
smyString = Replace(smyString, "'", "''")
sql = "Select * From SiteDocNew where [River/Site Name_en] ='" & smyString & "'"
myCommand = New OleDbDataAdapter(sql, conn)
'Fill command to fill the textboxes
myCommand.Fill(ds, "SiteDocNew")
txtLocationDesc.Text = ds.Tables("SiteDocNew").Rows(0).Item("Location & Access Description_en").ToString()
Is the 2nd page not working?
The second page is working with all other records with the exception of the first record on the drop down list.
And if I do click on the first record the second page does not even open...
Sorry I figured it out I just added a null line in the drop down list...
0 comments:
Post a Comment