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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:12:16+00:00 2026-05-27T17:12:16+00:00

I am about to create cascading dropdown lists in MVC 3. Logik is simple,

  • 0

I am about to create cascading dropdown lists in MVC 3. Logik is simple, for each location there may be many Employees, so best way i could figure out how to implement it is drop downlists.

what i have right now is :

1 list is filled up at begninnging with Locations. and on change i can get data into second my Employee list, but the data i transfer is Enumrable dates”.

As soon as i try to send Employees over with ID and name nothing happend.

Controller code:

public ActionResult Months(string locId)
{
  var k = service.getEmployeeForLocation(Int32.Parse(locId))
                 .ToList()
                 .Select(x => new
                         {
                           Value = .EmployeeId,
                           Text = x.Name 
                         });

  return Json(k,JsonRequestBehavior.AllowGet); 
}

View :

<tr>
<td>Choose your closest location : 
    @Html.DropDownListFor(x => x.SelectedLocation, Model.Locations)</td>
<td>Choose your closest location : 
    @Html.DropDownListFor(x => x.SelectedEmployee, 
                          Enumerable.Empty<SelectListItem>(), "-- select month --")
</tr>

Javascript

</script>
<script type="text/javascript">
    $('#SelectedLocation').change(function () {
        var selectedLocation = $(this).val();
        if (selectedLocation != null && selectedLocation != '') {
            $.getJSON('@Url.Action("Months")', { locId: selectedLocation }, 
            function (employee) {

                var EmployeeSelect = $('#SelectedEmployee');
                //                monthsSelect.empty();

                $.each(employee, function (index, employee) {
                    EmployeeSelect.append($('<option/>', {
                        value: employee.value,
                        text: employee.text
                    }));
                });
            });

        }
    });
</script>
  • 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-27T17:12:17+00:00Added an answer on May 27, 2026 at 5:12 pm

    One thing that I can see is that your variable names in your action start with an upper case and JavaScript is case sensitive. In your page you are using lowercase but they two should be upper case if you want to keep the casing in your controller.

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

Sidebar

Related Questions

I am about to create a simple demo in flash where I have 3
I'm about to create a function which adds two NSDateComponents together is there any
I am about to create an ASP.NET MVC app which will have over 2000
I need to create about 2 million vectors w/ 1000 slots in each (each
I'm about to create quite simple website which will contain several static pages (they
About to create a form using Zend Form, all the form elements should have
I'm about to create a web application that requires a lot of different web
I am about to create a ViewModel to pass some data to a View.
I was about to create a trim function in javascript, but as i don't
I am about to create a light version of an app of mine. 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.