Visualizzazione dei risultati da 1 a 5 su 5
  1. #1
    Utente di HTML.it L'avatar di SPEED78
    Registrato dal
    Jan 2003
    Messaggi
    358

    DropDownList che deve passare valori

    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

  2. #2
    hai messo

    AutoPostBack="true"

    nella DropDownList?
    "...non è detto che sia tardi se non guardi che ora è..."

  3. #3
    Utente di HTML.it L'avatar di SPEED78
    Registrato dal
    Jan 2003
    Messaggi
    358
    raffa non l'ho messo è necessario?
    garzie per ora

  4. #4
    puoi fare

    codice:
    Private Sub  DropDownList1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As eventargs)
            Label1.Text = DropDownList1.SelectedValue
            Label1.Visible = True
    End Sub
    mettendo

    AutoPostBack="true"
    OnSelectedIndexChanged="DropDownList1_SelectedInde xChanged"

    nella DropDownList.
    vedi se ti va bene
    "...non è detto che sia tardi se non guardi che ora è..."

  5. #5
    Utente di HTML.it L'avatar di SPEED78
    Registrato dal
    Jan 2003
    Messaggi
    358
    perfetto ti ringrazio

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.