DropDownLists

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
 

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,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top