losing event association after binding drop down list

Discussion in 'ASP .Net Web Controls' started by Ben, Aug 18, 2003.

  1. Ben

    Ben Guest

    Just find out that it seems to be the number of
    Dropdownlists that I bind that cause the problem...

    In fact, if I put any of the 3 InitializeDDL in comments,
    everything works just fine, but with all of them, I lose
    the event-association with my webform...

    I just don't get it...

    Thanx

    Ben

    >-----Original Message-----
    >Hi...
    >
    >I'm a newbie with asp and .NET and this problem really
    >blast my head off....
    >
    >I have a web form with some dropdownlists (DDL). In the
    >page load, only one DDL is bind. Then, according to the
    >selection that the user makes from the first DDL, all of
    >the other DDL binds themselves in the

    SelectedIndexChange
    >method of the first DDL (autopostback value is set to
    >TRUE). When I run my web form, the first selection bind
    >the other DDL correctly but then I lose all the event
    >that are associated with my web controls (Ex : no action
    >is done when I select another item from the first DDL,
    >and no button have action neither...)
    >
    >Here's a sample of my code
    >
    >******************************************************
    >
    >Private Sub Page_Load(ByVal sender As System.Object,
    >ByVal e As System.EventArgs) Handles MyBase.Load
    >
    > If Not Page.IsPostBack Then
    >
    > InitializeDDL1()
    >
    > End If
    >
    >End Sub
    >
    >Private Function InitializeDDL1()
    >
    >Dim sql As String = "SELECT Name, PlaneId FROM
    >[...]"
    >Dim cmd As New SqlCommand(sql, Con.cn)
    >
    >DDL1.DataSource = Con.GetDataSet(cmd)
    >DDL1.DataTextField = "Name"
    >DDL1.DataValueField = "PlaneId"
    >DDL1.DataBind()
    >DDL1.Items.Insert(0, "")
    >
    >End Function
    >
    >Private Sub DDL1_SelectedIndexChanged(ByVal sender As
    >System.Object, ByVal e As System.EventArgs) Handles
    >DDLVol.SelectedIndexChanged
    >
    >If Not DDL1.SelectedIndex = -1 And Not

    DDL1.SelectedIndex
    >= 0 Then
    >
    >Dim VolSel As New Vol(DDL1.SelectedItem.Value)
    >
    >InitializeLB1()
    >InitializeDDL2()
    >InitializeDDL3() ' **** This binding lose all event
    >association, if I put it in comments, everything works
    >just fine...
    >InitializeDDL4()
    >
    >[...]
    >
    >End Sub
    >
    >Private Sub InitializeDDL3()
    >
    >Dim Array1() As Escales
    >
    > Dim i As Integer
    > Dim VolSel As New Vol(DDL1.SelectedItem.Value)
    >
    > Array1 = VolSel.GetEscales
    >
    > For i = 0 To UBound(Escale) - 2
    > DDL3.Items.Insert(i, Array1(i).Name)
    >
    > Next
    > DDL3.Items.Insert(0, "")
    >
    > End Sub
    >
    >*******************************************************
    >
    >I really hope that someone can help me with this one!
    >
    >Thanks a lot
    >
    >Ben
    >
    >
    >.
    >
    Ben, Aug 18, 2003
    #1
    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. SirPoonga
    Replies:
    2
    Views:
    759
    Ben Strackany
    Jan 7, 2005
  2. weiwei
    Replies:
    0
    Views:
    1,014
    weiwei
    Jan 5, 2007
  3. msimmons
    Replies:
    0
    Views:
    473
    msimmons
    Jul 16, 2009
  4. Replies:
    5
    Views:
    267
  5. Replies:
    0
    Views:
    175
Loading...

Share This Page