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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T18:05:04+00:00 2026-06-13T18:05:04+00:00

I have two DropDownList elements in my model. [DisplayName(Site)] public List<KeyValuePair<int, string>> Site {

  • 0

I have two DropDownList elements in my model.

[DisplayName("Site")]
public List<KeyValuePair<int, string>> Site { get; set; }
public int SelectedSiteID { get; set; }
<%= Html.DropDownListFor(model => model.SelectedSiteID, new SelectList(Model.Site, "Key", "Value"))%>

[DisplayName("Data Center")]
public List<KeyValuePair<int, string>> DataCenter { get; set; }
public int SelectedDataCenterID { get; set; }
<%= Html.DropDownListFor(model => model.SelectedDataCenterID, new SelectList(Model.DataCenter, "Key", "Value"))%>

I am attempting to modify the collection of ListItem’s in my second DropDownList when the user makes a change to the first’s selection.

I think that this is possible in the following manner, but I wanted to confirm that this was good practice:

  • Using jQuery, bind to the first DropDownList’s change event.
  • When responding to the change event — send an AJAX request to the server with the newly selected value.
  • The server will respond with JSON representing a collection of ListItem objects for the second DropDownList.
  • Using jQuery, I modify the second DropDownList’s selection such that it contains the returned JSON elements.

This all seems a bit… non-MVC3y, if you will. Is this the standard way of achieving what I am asking, or is there a more clear way?

  • 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-06-13T18:05:05+00:00Added an answer on June 13, 2026 at 6:05 pm

    I think it would be best to use Jquery in this scenario.

    The best thing for you to do is bind the firstDropdown box to a OnChange event inside Jquery then using $.ajax load the data from JSONresult in your Controller. Once that data has been loaded load the data inside the secondDropdown.

    Let me know if you need some code help with this.

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

Sidebar

Related Questions

I am using MVC3, EF Model first. I have a form with two DropDownList
Form contains two dropdown lists created using code below. Both dropdown list elements have
I have two DropDownList <asp:DropDownList ID=ddl1 runat=server Width=173px CssClass=ddl > </asp:DropDownList> <asp:DropDownList ID=ddl2 runat=server
I have created two dropdownlist, what i am trying to do is make them
i have two select using as a dropdownlist for country/state everything works as i
I am using Asp.net dropdownlist in one of my form ..I have two dropdown
I have a dropdownlist that has the value of two columns in it... One
i have two dropdown list. first drop down:1 enter code here <form:select path=custName id=custName>
On my ASPX page I've added Dropdownlist. Elements in this list are divided to
I have two dropdownlist, a detailsview and a formview control in my page. The

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.