I have a @Html.DropDownList in the View. I like to default the value of what is select.
Note that @Html.DropDownList accepts a list. Not sure if there is a parameter to set it to a default value that is in the list.
I have a @Html.DropDownList in the View. I like to default the value of
Share
If you want to pre select a value that is already in your list, then you need to set
Selected = trueon theSelectListItem.There is also an option to pass an “option label” into the Html.DropDownList method but this is for rendering something like “Please choose a value from the list”.