Skip to content Skip to sidebar Skip to footer

MVC 3 Cascading DropDownLists

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 DropDow

Solution 1:

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.


Post a Comment for "MVC 3 Cascading DropDownLists"