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

  • Home
  • SEARCH
  • 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 595169
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T16:01:57+00:00 2026-05-13T16:01:57+00:00

this problem is driving me really mad. In an Asp.Net-application, I have two DropDownLists,

  • 0

this problem is driving me really mad.

In an Asp.Net-application, I have two DropDownLists, DropDownStore and DropDownCampaign.

<asp:DropDownList ID="storeDropDown" AppendDataBoundItems="true" 
     AutoPostBack="true" DataSourceID="storeSqlDataSource" 
     DataTextField="Name" DataValueField="StoreId" 
     runat="server" OnSelectedIndexChanged="storeDropDown_SelectedIndexChanged"> 
     <asp:ListItem Value="">Choose a store</asp:ListItem>
</asp:DropDownList>
<asp:DropDownList ID="campaignDropDown" DataSourceID="campaignSqlDataSource" 
     DataTextField="Name" DataValueField="CampaignLevelId" 
     AppendDataBoundItems="true" runat="server">
     <asp:ListItem Value="">Choose a campaign</asp:ListItem>
</asp:DropDownList>  

As you can see, they are both bound to SQLDataSources.

The SQLDataSource for the second DropDownList looks as follows:

<asp:SqlDataSource ID="campaignSqlDataSource"  runat="server" ConnectionString="<%$ ConnectionStrings:AFPMAdManagerConnectionString %>"
    SelectCommand="SELECT [CampaignLevelId], [Name] FROM [CampaignLevel] where [StoreId] = @StoreId">
    <SelectParameters>
        <asp:ControlParameter ControlID="storeDropDown" Name="StoreId" PropertyName="SelectedValue" Type="String" />
    </SelectParameters>        
</asp:SqlDataSource>    

so that the second DropDownList is bound, when the user chooses an entry of the first
DropDownList.

This works well. But when I set the value of the first DropDownList programmatically,
the second DropDownList is bound twice:

 protected void Page_Load(object sender, EventArgs e)
 {
    storeDropDown.SelectedValue = "someStore";       
 }

Why?

  • 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-13T16:01:58+00:00Added an answer on May 13, 2026 at 4:01 pm

    It’s being told to bind twice. It binds on the original value of the first dropdown (since that’s the controlID governing it), and then when you set it in Page_load event it binds it again.

    I would recommend binding it to a label with visible property set to False. Then on the first dropdown selectedindex changed, set the text property of the label.

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

Sidebar

Related Questions

This is driving me mad. I am creating an AIR application and everything is
This problem is driving me crazy. I have the following code: 'unprotect sheet If.Range(Start).Row+1<.Range(End).Row
This problem has been kicking my butt for a few days now. I have
Consider this problem: I have a program which should fetch (let's say) 100 records
I have seen this problem arise in many different circumstances and would like to
my jQuery skills are pretty good normally but this is driving me mad! It's
I have single-thread windows form application written with VB.NET and targeting Framework 1.1 .
I have a question on making a good subquery for this problem Let's say
I have this problem and it's drivin' me nuts! So I am developing my
This problem crops up every now and then at work. Our build machine can

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.