max. number of Web Control binding?

B

Billy Bob

Hi...

I'm a newbie with asp.NET and this problem really
bugs me out...

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 are binded 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...)I found out that it
seems to be the number of Dropdownlists that I bind that
cause the problem...

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

I really hope that someone can help me with this one
cause I just don't get it!

Thanks a lot

Ben

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)

' **** I have to put out one of them to make it work

InitializeLB1()
InitializeDDL2()
InitializeDDL3()
InitializeDDL4()

[...]

End Sub

' *** Another way to bind a DDL
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

*******************************************************



..
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,149
Latest member
Vinay Kumar Nevatia0
Top