I have a loop in razor which generates a template a number of times. Inside the template there is a dropdownlist
@Html.DropDownlistFor(x=>x.pasajero[i].option, Model.optionItems)
The dropdownlist is rendered, however no option is set with the selected="selected"
attribute.
I have been able to properly render the dropdownlist outside a loop using same values. Any ideas why?
Try:
Make sure
x.pasajero[i].option
has the same type asIdField
.