Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4029674
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T11:22:32+00:00 2026-05-20T11:22:32+00:00

I have 3 drop down boxes, created using the HTML select tag. On page

  • 0

I have 3 drop down boxes, created using the HTML select tag. On page load, the first box has a few names. Now, when I click on one of the names in the first box, some more names should appear in the second and when I click on a name in the second box, some more names should appear in the third box. How can I achieve this using AJAX? I have to use ASP.Net and MS SQL Server only. I’m a complete noob to AJAX and I’ve been educating myself about it, but nothing’s working out. I’ve been looking for the code for close to a week. I looked up w3schools.com, but when I tried that code, it didn’t work. Please help me out and please tell me step by step, the things required in order to make it work, and what goes where. I have a deadline that is fast approaching and am at my wit’s end trying to make it work. HELP ME!!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T11:22:33+00:00Added an answer on May 20, 2026 at 11:22 am

    I would recommend placing the three dropdownlists in an UpdatePanel and adding a trigger to each for the updatepanel. Then, when the value changes, re-populate the dropdown and let the updatepanel push the update. Also keeps session-state in case you want to submit the values.

    I don’t have a compiler in front of me, but if need be just post a comment and I’ll post the code tomorrow.


    Working Example

    I’m using the “Traditional template” that comes with visual studio and the master page, so excuse the content place holders. But this should demonstrate what I mean:

    <%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="MultiDropDown.aspx.cs" Inherits="AppSettingsRetrieval.MultiDropDown" %>
    <asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
        <script runat="server">
            protected void Page_Load(object sender, EventArgs e)
            {
                if (!Page.IsPostBack)
                {
                    String[] options = new[] { "ABC", "DEF", "GHI", "JKL", "MNO", "PQR", "STU", "VWX", "YZA" };
                    foreach (String option in options)
                    {
                        this.DropDownList1.Items.Add(new ListItem(option, option));
                    }
                }
            }
    
            public void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
            {
                this.DropDownList2.Items.Clear();
                this.DropDownList2.Items.Add(new ListItem("--- Please Select One ---"));
    
                String[] options = new[] { "123", "456", "789", "101", "112", "131", "415", "161", "718" };
                foreach (String option in options)
                {
                    var str = String.Format("{0} {1}", this.DropDownList1.SelectedValue, option);
                    this.DropDownList2.Items.Add(new ListItem(str, str));
                }
                this.DropDownList2.Enabled = true;
    
                this.DropDownList3.Enabled = false;
            }
    
            public void DropDownList2_SelectedIndexChanged(object sender, EventArgs e)
            {
                this.DropDownList3.Items.Clear();
                this.DropDownList3.Items.Add(new ListItem("--- Please Select One ---"));
    
                String[] options = new[] { "test", "testing", "tester", "foo", "bar", "foobar" };
                foreach (String option in options)
                {
                    var str = String.Format("{0} {1}", this.DropDownList2.SelectedValue, option);
                    this.DropDownList3.Items.Add(new ListItem(str, str));
                }
                this.DropDownList3.Enabled = true;
            }
        </script>
    </asp:Content>
    <asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
        <asp:ScriptManager runat="server" ID="ScriptManager1"></asp:ScriptManager>
    
        <asp:UpdatePanel runat="server" ID="UpdatePanel1" UpdateMode="Conditional">
            <ContentTemplate>
                <fieldset>
                    <legend>Consecutive Dropdown List</legend>
                    <p>
                        Primary Filter:
                        <asp:DropDownList runat="server" ID="DropDownList1" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged" AutoPostBack="true">
                            <asp:ListItem Text="---Please Select One---" />
                        </asp:DropDownList>
                    </p>
                    <p>
                        Secondary Filter:
                        <asp:DropDownList runat="server" ID="DropDownList2" OnSelectedIndexChanged="DropDownList2_SelectedIndexChanged" AutoPostBack="true" Enabled="false">
                            <asp:ListItem Text="---Please Select One---" />
                        </asp:DropDownList>
                    </p>
                    <p>
                        Final Filter:
                        <asp:DropDownList runat="server" ID="DropDownList3" Enabled="false">
                            <asp:ListItem Text="---Please Select One---" />
                        </asp:DropDownList>
                    </p>
                </fieldset>
            </ContentTemplate>
        </asp:UpdatePanel>
    </asp:Content>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.