468,554 Members | 1,966 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,554 developers. It's quick & easy.

dropdownlist selectedIndexChanged event not firing

i have a userControl (.ascx) that has a dropdownlist embedded in a datagrid.
the dropdownlist autopostback is set to true. why isn't the
selectedIndexChanged firing?

Private Sub grdNewVideos_ItemCreated(ByVal sender As Object, ByVal e
As System.Web.UI.WebControls.DataGridItemEventArgs) Handles
grdNewVideos.ItemCreated
If e.Item.ItemType = ListItemType.EditItem Then
AddHandler CType(e.Item.FindControl("ddlArtistNames"),
DropDownList).SelectedIndexChanged, AddressOf
ddlArtistNames_SelectedIndexChanged
End If
End Sub

Private Sub ddlArtistNames_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
grdNewVideos.SelectedIndexChanged
Dim artistName As String = CType(sender,
DropDownList).SelectedItem.Text
Dim lblArtistNames As Label

lblArtistNames =
CType(grdNewVideos.Items(grdNewVideos.EditItemInde x).FindControl("lblArtistNames "), Label)

ArtistNames += artistName

lblArtistNames .Text = ArtistNames
End Sub
Nov 19 '05 #1
1 2458
i wasn't testing the

If Not IsPostBack Then in the Page_Load before databinding.

"CurlyFro" wrote:
i have a userControl (.ascx) that has a dropdownlist embedded in a datagrid.
the dropdownlist autopostback is set to true. why isn't the
selectedIndexChanged firing?

Private Sub grdNewVideos_ItemCreated(ByVal sender As Object, ByVal e
As System.Web.UI.WebControls.DataGridItemEventArgs) Handles
grdNewVideos.ItemCreated
If e.Item.ItemType = ListItemType.EditItem Then
AddHandler CType(e.Item.FindControl("ddlArtistNames"),
DropDownList).SelectedIndexChanged, AddressOf
ddlArtistNames_SelectedIndexChanged
End If
End Sub

Private Sub ddlArtistNames_SelectedIndexChanged(ByVal sender As
System.Object, ByVal e As System.EventArgs) Handles
grdNewVideos.SelectedIndexChanged
Dim artistName As String = CType(sender,
DropDownList).SelectedItem.Text
Dim lblArtistNames As Label

lblArtistNames =
CType(grdNewVideos.Items(grdNewVideos.EditItemInde x).FindControl("lblArtistNames "), Label)

ArtistNames += artistName

lblArtistNames .Text = ArtistNames
End Sub

Nov 19 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Robert Hanson | last post: by
reply views Thread by aboivin | last post: by
1 post views Thread by UniDue | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.