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 6744125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T12:02:46+00:00 2026-05-26T12:02:46+00:00

I am trying to setup a cascaded drop down box where the first one

  • 0

I am trying to setup a cascaded drop down box where the first one will result in the second one’s value being changes and so on. I have some markup like this:

<form id="ddlSelections" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true" />

    <asp:UpdatePanel ID="UpdatePanel2" runat="server" ChildrenAsTriggers="true" UpdateMode="Conditional">
        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="DDL1" EventName="SelectedIndexChanged" />
            <asp:AsyncPostBackTrigger ControlID="DDL2" EventName="SelectedIndexChanged" />
        </Triggers>
        <ContentTemplate>
            <asp:DropDownList ID="DDL1" OnSelectedIndexChanged="OnDDL1Change" AutoPostBack="true" runat="server" />
            <asp:DropDownList ID="DDL2" OnSelectedIndexChanged="OnDDL2Change" AutoPostBack="true" runat="server" />
            <asp:DropDownList ID="DDL3" runat="server" />
        </ContentTemplate>
    </asp:UpdatePanel>
</form>

And my code-behind is something like this:

protected void Page_Load(object sender, EventArgs e)
{
    populateDDL1();
}

private void populateDDL1()
{
    DDL1.Items.Clear();
    // -- populate from SQL
}

protected void OnDDL1Change(object sender, EventArgs e)
{
    DDL2.Items.Clear();
    // -- populate from SQL
}

This is working except that everytime I click on the first drop down box, the values in the second drop down box get populated but the values in the first drop down box are being re-populated i.e. it looks like populateDDL1() is being called which of course will not be called unless Page_Load is called! I am failing to understand why this is the case. Any suggestions on where I am going wrong?

  • 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-26T12:02:47+00:00Added an answer on May 26, 2026 at 12:02 pm

    You are populating the first dropdownlist on every page load.
    You need to do that only on the first load.
    Wrap your populateDDL1 call in if (!IsPostBack), which is a backward way of saying to only populate it the first time the page loads.

    To test this, put a breakpoint on that line in Page_Load.

    Just because it’s an ajax-y UpdatePanel doesn’t mean that the server-side methods don’t run.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to map inheritance with discriminator, but subclasses don't have discriminator value. How
Trying to setup a simple Thread/Poll table mapping. Here is what I have: Threads
Trying to setup plone2pdf in Plone 4. I have downloaded the Plone2pdf archive, extracted
im trying to setup sqlite as a secondary adapter and have run into a
Im trying to setup a program that will accept an incoming email and then
I am trying to setup a 1to0..1 (zero or one) relationship, but am running
I'm trying setup a subset of boost and get it properly compiled using bjam,
Trying to setup an SSH server on Windows Server 2003. What are some good
Trying to setup a CodeIgniter based project for local development (LAMP stack), and once
After trying to setup my site for Google Webmaster Tools I found that my

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.