dropdownlist selectedIndexChanged event not firing

Discussion in 'ASP .Net' started by =?Utf-8?B?Q3VybHlGcm8=?=, Aug 14, 2005.

  1. 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.EditItemIndex).FindControl("lblArtistNames "), Label)

    ArtistNames += artistName

    lblArtistNames .Text = ArtistNames
    End Sub
     
    =?Utf-8?B?Q3VybHlGcm8=?=, Aug 14, 2005
    #1
    1. Advertising

  2. 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.EditItemIndex).FindControl("lblArtistNames "), Label)
    >
    > ArtistNames += artistName
    >
    > lblArtistNames .Text = ArtistNames
    > End Sub
     
    =?Utf-8?B?Q3VybHlGcm8=?=, Aug 14, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. DesignerX
    Replies:
    2
    Views:
    3,836
    Bob Carsto
    Nov 14, 2003
  2. Paul Lacey
    Replies:
    2
    Views:
    2,707
    =?Utf-8?B?TmlrYW5kZXIgJiBNYXJncmlldCBCcnVnZ2VtYW4=
    Feb 17, 2005
  3. Lew Barnesson
    Replies:
    3
    Views:
    809
    Lew Barnesson
    Dec 4, 2004
  4. BentleyInc

    DropDownList.SelectedIndexChanged event not firing

    BentleyInc, Dec 10, 2004, in forum: ASP .Net Web Controls
    Replies:
    4
    Views:
    1,258
    Steven Cheng[MSFT]
    Dec 14, 2004
  5. Dabbler

    DropDownList selectedIndexChanged event not firing

    Dabbler, May 6, 2005, in forum: ASP .Net Web Controls
    Replies:
    6
    Views:
    820
    Josh Behl
    Aug 13, 2006
Loading...

Share This Page