I have the following code that generates a drop-down list with values:
@Html.DropDownListFor(m => Model.BeslutsinformationstypId, VardemangderHelper.BeslutsInformationsTyperForInteckningarGetList(), new { @class = "form-control")})
Now I want to a select option per default. I have tried the following:
@Html.DropDownListFor(m => Model.BeslutsinformationstypId, VardemangderHelper.BeslutsInformationsTyperForInteckningarGetList(), new { @class = "form-control", Selected = VardemangderHelper.BeslutsInformationsTyperForInteckningarGetList().First(x => x.Value == "320").Selected = true})
But that don't work. How can I set selected option based on the values from VardemangderHelper.BeslutsiinformationsTyperForInteckningarGetList()
?
Is It possible to do this in Razor?