Click here to Skip to main content
15,892,059 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi, I have a requirement of cascading 3 dropdowns in MVC which are interrelated to each other. I am using Chosen plugin of JQuery.
First dropdown is auto filled from controller, 2nd dropdown is filled on select of 1st and 3rd dropdown will be filled on select of 2nd.

Requirement:
First dropdown is auto filled from controller with first value auto selected on page load. Base on this 2nd dropdown is auto filled and first value preselected and based on this preselected value 3rd dropdown is auto filled with first value preselected. All this functionality should be done automatically on page load.
If user change at dropdown then the conditions changes accordingly but first part should be automatic without any click or change event.

The code is very big so cant provide here.
Thanks

What I have tried:

I am trying to load 2nd and third dropdown on change event using Ajax. But I want to do it automatically. Pls help me by giving me some example or URL if possible,
Thanks.
Posted
Updated 3-Feb-17 22:17pm
Comments
j snooze 1-Feb-17 17:16pm    
This link has a couple different ways to do it. Either jquery and appending the option tag onto your drop downs, our using partials for each drop down.
http://stackoverflow.com/questions/7253187/fill-a-drop-down-list-dynamically-using-javascript-jquery

1 solution

 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900