I have two drop down lists and I need to be able to depending on what is selected in the first dropdown list it will filter the second one and only give certain options.
This is in MVC by the way.
This is how my DropDownLists are created.
@Html.DropDownListFor(model => model.ProductsID, Model.HowProductsAreUsedOptions,new { @class = "General", id = "General" })
@Html.DropDownListFor(model => model.ApplicationSecondaryValue, Model.ApplicationSecondary, "--Choose One--", new { id = "Secondary" })
And here is the HTML rendered for it.
<select class="General" id="General-0" name="ProductsID"><option selected="selected" value="0">Select</option>
<option value="1">Option1</option>
<option value="2">Option2</option>
<option value="3">Option3</option>
</select>
<select data-val="true" data-val-number="The field ApplicationSecondaryValue must be a number." data-val-required="The ApplicationSecondaryValue field is required." id="Secondary" name="ApplicationSecondaryValue"><option value="">--Choose One--</option>
<option value="1">Choice1</option>
<option value="2">Choice2</option>
<option value="3">Choice3</option>
<option value="4">Choice4</option>
<option value="5">Choice5</option>
<option value="6">Choice6</option>
<option value="7">Choice7</option>
<option value="8">Choice8</option>
<option value="9">Choice9</option>
<option value="1">Different1</option>
<option value="2">Different2</option>
<option value="3">Different3</option>
<option value="4">Different4</option>
<option value="1">AnotherChoice1</option>
<option value="2">AnotherChoice2</option>
<option value="3">AnotherChoice3</option>
<option value="4">AnotherChoice1</option>
<option value="5">AnotherChoice5</option>
</select>
So for Option 1 I would need to only display the "Choices" Option 2 would be the "different" and then Option 3 would be "anotherchoice" Any help would be greatly appreciated!
The dropdown lists are populated using dictionaries and "foreach" statements.