Help, Populating dropdowns via subroutine

Discussion in 'ASP .Net' started by Paul D. Fox, Aug 25, 2005.

  1. Paul D. Fox

    Paul D. Fox Guest

    I'd like to populate four dropdowns using code behind. Each dropdown contains the same list. How can I populate them using a subroutine. Something like:

    InitializeDropDownList(ddlQuadrant1) 'Where ddlQuadrant1 is the first dropdown
    InitializeDropDownList(ddlQuadrant2) 'Where ddlQuadrant2 is the second dropdown
    InitializeDropDownList(ddlQuadrant3) 'Where ddlQuadrant3 is the third dropdown
    InitializeDropDownList(ddlQuadrant4) 'Where ddlQuadrant4 is the fourth dropdown
    Which calls something like this:

    Private Sub InitializeDropDownList(ByVal ctlDropDownList As DropDownList)

    ctlDropDownList.Items.Insert("", "")
    ctlDropDownList.Items.Insert("Application/Credit", "Application/Credit")
    ctlDropDownList.Items.Insert("Note Features", "Note Features")
    ctlDropDownList.Items.Insert("Regency", "Regency")
    ctlDropDownList.Items.Insert("ARM Info", "ARM Info")
    ctlDropDownList.Items.Insert("Pay History", "Pay History")
    ctlDropDownList.Items.Insert("Property", "Property")
    ctlDropDownList.Items.Insert("Valuation Comments", "Valuation Comments")
    ctlDropDownList.Items.Insert("Diligence Comments", "Diligence Comments")
    ctlDropDownList.Items.Insert("Compliance", "Compliance")

    End Sub
     
    Paul D. Fox, Aug 25, 2005
    #1
    1. Advertising

  2. Paul D. Fox

    Paul D. Fox Guest

    Nevermind, I figured out my issue, the first parameter in the "Items.Insert" needs a sequence number (e.g. 0 for first item, 1 for second item, and so on)
    "Paul D. Fox" <> wrote in message news:...
    I'd like to populate four dropdowns using code behind. Each dropdown contains the same list. How can I populate them using a subroutine. Something like:

    InitializeDropDownList(ddlQuadrant1) 'Where ddlQuadrant1 is the first dropdown
    InitializeDropDownList(ddlQuadrant2) 'Where ddlQuadrant2 is the second dropdown
    InitializeDropDownList(ddlQuadrant3) 'Where ddlQuadrant3 is the third dropdown
    InitializeDropDownList(ddlQuadrant4) 'Where ddlQuadrant4 is the fourth dropdown
    Which calls something like this:

    Private Sub InitializeDropDownList(ByVal ctlDropDownList As DropDownList)

    ctlDropDownList.Items.Insert("", "")
    ctlDropDownList.Items.Insert("Application/Credit", "Application/Credit")
    ctlDropDownList.Items.Insert("Note Features", "Note Features")
    ctlDropDownList.Items.Insert("Regency", "Regency")
    ctlDropDownList.Items.Insert("ARM Info", "ARM Info")
    ctlDropDownList.Items.Insert("Pay History", "Pay History")
    ctlDropDownList.Items.Insert("Property", "Property")
    ctlDropDownList.Items.Insert("Valuation Comments", "Valuation Comments")
    ctlDropDownList.Items.Insert("Diligence Comments", "Diligence Comments")
    ctlDropDownList.Items.Insert("Compliance", "Compliance")

    End Sub
     
    Paul D. Fox, Aug 25, 2005
    #2
    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. sck10

    Populating DropDowns

    sck10, Nov 2, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    407
    Steven Cheng[MSFT]
    Nov 15, 2004
  2. =?Utf-8?B?QW5keQ==?=

    Populating multiple dropdowns

    =?Utf-8?B?QW5keQ==?=, Apr 21, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    443
    Brock Allen
    Apr 21, 2005
  3. Anup
    Replies:
    2
    Views:
    443
  4. Anup

    Populating dropdowns client-side?

    Anup, Jun 20, 2006, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    123
  5. king
    Replies:
    5
    Views:
    207
Loading...

Share This Page