I have seen this question, but still unclear about the following:
I have a SelectListItem that I populate like this:
MySelectList.Insert(0, new SelectListItem { Text = "Text0", Value = "0" });
MySelectList.Insert(1, new SelectListItem { Text = "Text1", Value = "1" });
And in my view I display it like this:
@Html.DropDownListFor(m => m.MyId, Model.MySelectList, new { @class = "form-control" })
If I select Text0 and post the model to controller, MyId contains the the selected value, which is perfect.
But when I go through MySelectList, the Selected value is not set to true for any of the items in the list:
I know I can use MyId to find the selected value, but is there any way to get Selected set to true when user selects an item from the Drop Down and post the form?
