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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T07:57:05+00:00 2026-06-18T07:57:05+00:00

So on a change of one drop down list I’m trying to populate a

  • 0

So on a change of one drop down list I’m trying to populate a second list.

I have this client side function:

 $('#ProjectReference').change(function() {

       var url = "@Url.Action("GetProjectIterations", "Rally")";
       var data = { selectedProject: $('#ProjectReference').val() };


       $.getJSON(url, data, function(iterations) {
              alert("hello?");
              var items;
              $.each(iterations, function(i, iteration) {
                   items += "<option value='" + iteration.Name + "'>" + iteration.Name + "</option>";
              });
            }
       );

       $.ajax({
            url: url,
            type: 'GET',
            dataType: 'json',
            data: data,
            contentType: 'application/json; charset=utf-8',
            success: function (iterations) {
                        alert("hello?");
                        var items;
                        $.each(iterations, function(i, iteration) {
                            items += "<option value='" + iteration.Name + "'>" + iteration.Name + "</option>";
                        });

                        $("#ProjectIteration").html(items);},
             failure: function () { alert("nope");}
            });
        });

I’ve tried 2 different formats for calling my controller (so I know I don’t need both – I’ve just included both to highlight what I’ve tried).

My controller gets called, I am returning data but none of my alerts get fired (and nothing happens to the drop down list I am trying to update). So maybe the way I’m returning my data isn’t correct? My select list has a count of 33 so it appears to have data before its returned.

public ActionResult GetProjectIterations(string selectedProject)
{
     var projectIterations = cache.Get("ProjectIterations") as Hashtable;
     var iterations = (projectIterations[selectedProject] as ArrayList).Cast<DynamicJsonObject>().ToList();
     var selectList = iterations.Select(
            iteration => new SelectListItem {Text = iteration["Name"], Value = iteration["Name"]});
     return Json(selectList);
}
  • 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-18T07:57:06+00:00Added an answer on June 18, 2026 at 7:57 am

    Since you’re using GET you need to be changing the JsonRequestBehavior on your controller action.

    In your example, the code should be:

    public ActionResult GetProjectIterations(string selectedProject)
    {
         var projectIterations = cache.Get("ProjectIterations") as Hashtable;
         var iterations = (projectIterations[selectedProject] as ArrayList).Cast<DynamicJsonObject>().ToList();
         var selectList = iterations.Select(
                iteration => new SelectListItem {Text = iteration["Name"], Value = iteration["Name"]});
         return Json(selectList, JsonRequestBehavior.AllowGet); //check the overload for Json()
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have two Drop Down Lists, the second ones are based off which one
I have a drop down list on a form with values: Value One Value
I have one drop-down list (<select> <option>) on page with id="coclevel1" . If current
I have two drop down list on a page. The first one list projects
I have a drop-down list as, <select id='idleReason' onChange=loadXMLDoc(this.value) size=1> <option value=nothing selected=selected>Select a
I want to populate one drop down list based on the selection of another
There is a drop down list bind with datasource -> Called This DropDownList A
I have three drop down list <h:selectOneMenu> , and a <p:dataTable> . I want
I have the following HTML containing a drop down list (single selection) <script type="text/javascript">
I have a drop down list and some code to perform the operation to

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.