Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SelectedIndexChanged event will not fire
Message
De
02/03/2004 21:36:17
Keith Payne
Technical Marketing Solutions
Floride, États-Unis
 
 
À
02/03/2004 19:20:48
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00882556
Message ID:
00882580
Vues:
22
This message has been marked as the solution to the initial question of the thread.
Vince,

To use SelectedIndexChanged, you have to set the list to do a postback on each click. Set .AutoPostBack = Enabled in the list control's properties.

>Hello
>for some reason the selectedIndexChanged event will not fire in asp. Here is my code
>
>Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
>If Not Page.IsPostBack Then
> Dim conn3 As SqlConnection
> Dim conn4 As SqlConnection
> conn4 = New SqlConnection _
> ("data source=SEWD1\NETSDK;integrated security=true;initial catalog=pubs")
>
> Dim drStore As SqlDataReader
> Dim cmdStores As SqlCommand
> conn4.Open()
> cmdStores = New SqlCommand("select * from stores", conn4)
> drStore = cmdStores.ExecuteReader()
> lstStores.DataSource = drStore
> lstStores.DataTextField = "stor_name"
> lstStores.DataValueField = "stor_name"
> lstStores.DataBind()
> drStore.Close() 'tried with and without
> End If
>End Sub
>
>Private Sub lstStores_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstStores.SelectedIndexChanged
>Dim strStore As String = lstStores.SelectedItem.Value
>Label1.Text = strStore
>End Sub
>
>
>The dropdown populates, but when I click, nothing happens. What am I doing wrong????
>
>Vince Bologna, newBee
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform