Salve ragazzi ho un piccolo problema con una DropDownList.
praticamente vorrei che mi passare il valore del value senza inserire un bottone di invio
io pensavo fosse sufficiente inserire l'evento DropDownList1_SelectedIndexChanged
posto il codice:
codice:
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Label1.Text = "benvenido"
Dim connessione As New System.Data.OleDb.OleDbConnection
Dim sql As New System.Data.OleDb.OleDbCommand
connessione.ConnectionString = "provider=Microsoft.Jet.OLEDB.4.0; " & _
"Data Source=" & Server.MapPath("mdb-database/ok.mdb;")
Dim selectsql As String
selectsql = "select * from locali"
Dim cmd As New OleDbCommand(selectsql, connessione)
connessione.Open()
Dim reader As OleDbDataReader
reader = cmd.ExecuteReader()
Do While reader.Read()
Dim item As New ListItem
item.Text = reader("locale")
item.Value = reader("idlocale")
DropDownList1.Items.Add(item)
Loop
reader.Close()
End Sub
Private Sub DropDownList1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
Label1.Text = DropDownList1.SelectedValue
Label1.Visible = True
End Sub
vi ringrazio in anticipo