DropDownLists

Discussion in 'ASP .Net' started by Steve Caliendo, Jun 8, 2004.

  1. 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
    Steve Caliendo, Jun 8, 2004
    #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. Peter J. Hunter

    Positioning in dropdownlists

    Peter J. Hunter, Jan 14, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    508
    Peter J. Hunter
    Jan 14, 2004
  2. Craig Buchanan

    parent child dropdownlists acting oddly

    Craig Buchanan, Jun 27, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    460
    Craig Buchanan
    Jun 27, 2003
  3. Darren

    Multiple DropDownLists

    Darren, Aug 18, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    397
    Steve C. Orr, MCSD
    Aug 18, 2003
  4. Colin Basterfield

    DropDownLists in XSLT

    Colin Basterfield, Dec 17, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    481
    Colin Basterfield
    Dec 17, 2003
  5. Craig Buchanan

    reuse SQLDataReader in multiple dropdownlists?

    Craig Buchanan, Jan 12, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    3,263
    Craig Buchanan
    Jan 15, 2004
Loading...

Share This Page