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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:34:50+00:00 2026-05-23T18:34:50+00:00

I don’t know how to exactly have Cascading DropDownLists My scenario is the next:

  • 0

I don’t know how to exactly have Cascading DropDownLists

My scenario is the next:

Category has Items and Items have quantities depending on Establishment

I want to have two DropDownLists one which you select a Category, next one is populated when you make a selection of the first with the Items in that Category, and when you select the Item a table with the quantities for each establishment is shown.

Ok this would be my ActionResult

public ActionResult ItemByClinic(Guid? Item_ID, Guid? Category_ID)
    {
        ViewData["Categories"] = InventoryDb.Categories;
        if (Category_ID != null)
        {
            ViewBag.Category_ID = Category_ID;
            ViewData["Items"] = InventoryDb.Items.Where(i => i.Category.ID == Category_ID);
            if (Item_ID != null)
            {
                ViewBag.Item_ID = Item_ID;
                ViewData["Inventory"] = InventoryDb.Items.Single(i => i.ID == Item_ID).Inventory;
            }
        }
        return View();
    }

then, I would have my two DropDownLists that should post values to Item_ID and Category_ID … first category then item

@Html.DropDownList("Categories", new SelectList((IQueryable<Inventario_Data.Models.Category>)ViewData["Categories"], "ID", "Name", ViewBag.Category_ID), "Select an Item Category", new { onchange = "window.location.href = '/Inventory/ItemByClinic/Categody_ID=' + this.value" })

This is what I don’t know how to do … how should I put the URL or how should I send it, so when I send the other ID does’nt mix up and I can receive my IDs

How do I receive the values of each DropDownList in the ActionResult? how should they be sent?

ANSWER

I found the answer from this website, just wanted to let know what I did

http://kmsystems.squarespace.com/journal/2009/5/31/aspnet-mvc-cascading-dropdownlists.html

  • 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-23T18:34:50+00:00Added an answer on May 23, 2026 at 6:34 pm

    The way you are describing your problem sounds like you are trying to do too many things at once.

    To make it easier to explain, I’m going to use the Country / State lookup use case. (When I select “Country”, the “State” drop down is populated.)

    You have 4 elements:

    1. Initial form load (no country, no state selected)
    2. Country selected, State populated
    3. Country selected, State selected
    4. Error handling (invalid Country & State combination)

    When I have come across this, I handle Step 1 & 3 in a view similar to your example.

    So are you getting stuck on step 2? What do you mean when you say ” how should I put the URL or how should I send it,”

    For me, I’ll address step 2 by creating javascript controller and use jquery to post & return json objects triggered when the Country dropdown box is selected.

    I found the MVC Music Store and Nerd Dinner examples to be extremely helpful.

    If you need an example of the json / jquery, see the shopping cart in The Music Store example.

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

Sidebar

Related Questions

Don't know if this has been answered before. Have custom routes to users. If
Don't know if this has been asked before, so point me to another question
Don't know whats exactly going on, but it's definitely killing my time for nothing.
Don't know if this is possible, but I have some code like this: val
Don't exactly know what to search for: If i edit text in vim it
Don't know why but I can't find a solution to this. I have 3
Don't know the term for the red validation border, does it have one? I
don't know better title for this, but here's my code. I have class user
don't know if the title describes anything about what I'm trying to say but
Don't ask me how but I'm in a situation where I have DCPs published

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.