populate dropdown onchange without reloading page

Discussion in 'ASP .Net' started by Stimp, Oct 10, 2005.

  1. Stimp

    Stimp Guest

    I have 2 dropdowns, county and district.

    When the county changes, I want the district dropdown to automatically
    update with a list of districts in that county, but I don't want the
    page to have to reload when county changes.

    I remember doing this before in classic ASP with javascript, can I do
    this with a dropdownlist in ASP.NET or should I stick with the HTML
    dropdown?

    Thanks,
    Peter
    --

    "I hear ma train a comin'
    .... hear freedom comin"
     
    Stimp, Oct 10, 2005
    #1
    1. Advertising

  2. Stimp

    Karl Seguin Guest

    It has to be done in JavaScript. Whether you use an ASP.Net dropdownlist or
    the HTML <select> really doesn't matter. Just note that items added to the
    dropdownlist dynamically won't exist when you do post back. You'll need to
    use the good-old Request.Form.

    You can check out:
    http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnaspp/html/ASPNetSpicedAjax.asp

    which has an AJAX implementation of creating linked dropdowns..

    Karl

    --
    MY ASP.Net tutorials
    http://www.openmymind.net/
    http://openmymind.net/redirector.aspx?documentId=51 - Learn about AJAX!



    "Stimp" <> wrote in message
    news:...
    >I have 2 dropdowns, county and district.
    >
    > When the county changes, I want the district dropdown to automatically
    > update with a list of districts in that county, but I don't want the
    > page to have to reload when county changes.
    >
    > I remember doing this before in classic ASP with javascript, can I do
    > this with a dropdownlist in ASP.NET or should I stick with the HTML
    > dropdown?
    >
    > Thanks,
    > Peter
    > --
    >
    > "I hear ma train a comin'
    > ... hear freedom comin"
     
    Karl Seguin, Oct 10, 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. Urs Vogel
    Replies:
    2
    Views:
    2,428
    Urs Vogel
    Jun 10, 2004
  2. Alex Gurevich
    Replies:
    2
    Views:
    4,935
    t3kboi
    Mar 26, 2009
  3. David C

    Populate DropDown in Master Page

    David C, Sep 21, 2009, in forum: ASP .Net
    Replies:
    7
    Views:
    1,232
    Hillbilly
    Sep 24, 2009
  4. Steve Myers
    Replies:
    2
    Views:
    284
    Steve Myers
    Nov 20, 2003
  5. Enjoy Life
    Replies:
    2
    Views:
    293
    Roland Hall
    Feb 23, 2005
Loading...

Share This Page