I have a Drop down List and button on an asp page as such:
asp
ropDownList id="DropAuthors" runat="server"
asp:Button id="Button1" runat="server" Text="Pick Author"
The dropdown list is populated from a Database Table using the following code:
Dim myConnection As SqlConnection
Dim myCommand As SqlCommand
Dim dtrAuthors
' Create a connection to the "pubs" SQL database located on
' the local computer.
myConnection = New SqlConnection("UID=******;PWD=******;" & _
"Server=localhost;database=pubs;")
' Connect to the SQL database using a SQL SELECT query to get all
' the data from the "Authors" table.
myConnection.Open()
myCommand = New SqlCommand("SELECT au_lname FROM authors", _
myConnection)
dtrAuthors = myCommand.ExecuteReader()
DropAuthors.DataSource = dtrAuthors
DropAuthors.DataTextField = "au_lname"
DropAuthors.DataBind()
myConnection.Close()
I want to pass the value of DropDownList to another form when I click the button.
anyone any Ideas??
Thanks in advance,
macca
asp
asp:Button id="Button1" runat="server" Text="Pick Author"
The dropdown list is populated from a Database Table using the following code:
Dim myConnection As SqlConnection
Dim myCommand As SqlCommand
Dim dtrAuthors
' Create a connection to the "pubs" SQL database located on
' the local computer.
myConnection = New SqlConnection("UID=******;PWD=******;" & _
"Server=localhost;database=pubs;")
' Connect to the SQL database using a SQL SELECT query to get all
' the data from the "Authors" table.
myConnection.Open()
myCommand = New SqlCommand("SELECT au_lname FROM authors", _
myConnection)
dtrAuthors = myCommand.ExecuteReader()
DropAuthors.DataSource = dtrAuthors
DropAuthors.DataTextField = "au_lname"
DropAuthors.DataBind()
myConnection.Close()
I want to pass the value of DropDownList to another form when I click the button.
anyone any Ideas??
Thanks in advance,
macca