S
Steve Caliendo
Hi,
I'm having trouble with multiple dynamically generated dropdownlists. On my
web page I have several text boxes / labels / checkboxes and dropdownlists
I have no problem setting the other controls to display what I would like
them to, but the dropdownlist boxes are simply not working. I can't set the
selectedindex to be different for each of the controls. What I'm doing is
this:
Dim TB2 = New TextBox()
Dim TB3 = New TextBox()
Dim DD1 = New DropDownList()
Dim CB1 = New CheckBox()
Dim CB2 = New CheckBox()
This works fine:
TB2.text = Rs1.Item(4)
TB3.text = Rs1.Item(5)
This also works (2 of the dynamic dropdownlists out of 10 get the contents
of dropdownlist2):
If i = 1 Or i = 3 Then
For j = 1 To DropDownList2.Items.Count
DD1.Items.Add(DropDownList2.Items(j - 1))
Next
End If
This doesn't work:
If i = 1 Then DD1.SelectedIndex = 0
If i = 3 Then DD1.SelectedIndex = 1
When the web page is displayed, *BOTH* dropdownlists have the selectedindex
set to 1
Any ideas?
Thanks,
Steve
I'm having trouble with multiple dynamically generated dropdownlists. On my
web page I have several text boxes / labels / checkboxes and dropdownlists
I have no problem setting the other controls to display what I would like
them to, but the dropdownlist boxes are simply not working. I can't set the
selectedindex to be different for each of the controls. What I'm doing is
this:
Dim TB2 = New TextBox()
Dim TB3 = New TextBox()
Dim DD1 = New DropDownList()
Dim CB1 = New CheckBox()
Dim CB2 = New CheckBox()
This works fine:
TB2.text = Rs1.Item(4)
TB3.text = Rs1.Item(5)
This also works (2 of the dynamic dropdownlists out of 10 get the contents
of dropdownlist2):
If i = 1 Or i = 3 Then
For j = 1 To DropDownList2.Items.Count
DD1.Items.Add(DropDownList2.Items(j - 1))
Next
End If
This doesn't work:
If i = 1 Then DD1.SelectedIndex = 0
If i = 3 Then DD1.SelectedIndex = 1
When the web page is displayed, *BOTH* dropdownlists have the selectedindex
set to 1
Any ideas?
Thanks,
Steve