I am working on a website in ASP .NET MVC 3 using Razor and C#.
I have two drop down lists on a view – one for Device Type and one for Device Model. The contents for the Device Model drop down list are based off the Device Type selected. Also the Device Model drop down should be disabled until a Device Type has been selected. I would prefer the functionality to be client side.
How can I achieve this?
EDIT: Received answer in a different question: Fill a drop down list dynamically using Javascript/jQuery
Why not place the 2nd dd list in a container div, use Ajax to post the selected value from the first list to a controller action (onchange) that returns the rendered partial as HTML to the client and then replaces the HTML of the 2nd list’s container with the action result.
If you’re open to using jquery look into $.ajax and replaceWith to speak with your controller action and to dynamically rewrite your target div html respectively.