I have two DropDownListFor. If I choose a item in the first DropDownListFor the second DropDownListFor must remove some items. So to clear things up:
DropDownListFor 1 -> has items: 'a', 'b', 'c'.
DropDownListFor 2 -> has items: '1', '2', '3'.
If in DropDownListFor1 item 'a' is selected -> DropDownListFor2 only shows the items '1' and '3'.
This is DropDownListFor 1:
@Html.ExtendedDropDownListFor(m => m.Alert.TriggerType,
Model.TriggersDTO.Select(t => new ExtendedSelectListItem() {
Text = t.Translation,
Value = t.Type.ToString(),
htmlAttributes = new { data_id = t.Id }
}).AsEnumerable(), null, new { id = "trigger-type", name = "trigger-type" })
This is DropDownListFor 2:
@Html.DropDownListFor(m => m.Alert.Condition,
new SelectList(Model.ConditionsDTO, "Type", "Translation"),
new { id = "condition-type", name = "condition-type" })
All items come from the database.
If I change the first DropDownListFor, the next function is called:
function doTriggerTypeSelect() {
switch ($('#trigger-type').val()) {
case 'a':
$('#container-a').show();
break;
case 'b':
$('#container-b').show();
break;
case 'c':
$('#container-c').show();
break;
}
}
Is it possible to do here the functionality for my issue? If you need more code, just ask.