DropDownList/ Button Problem

macca

Member
Joined
Mar 3, 2005
Messages
7
Programming Experience
Beginner
I have a Drop down List and button on an asp page as such:

asp:DropDownList 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
 

Neske

Member
Joined
Mar 1, 2005
Messages
17
Programming Experience
Beginner
hi

Session("Value") = DropAuthors.SelectedValue
and on the other page you call it back like author = Session("Value")
I would do it like this but you can also use the querystring

Neske
 
Top Bottom