I have this razor's statement in a view that create a dropdownlist. How can I mantain the selected value after a post-back to the server ? I set the selected value in a ViewBag property once on the server but I was not able to set the value again.
@Html.DropDownListFor(x => x.Languages, Model.Languages.Select(x => new SelectListItem { Text = x.Descr, Value = x.Code }), "Choose an option", new { htmlAttributes = new { @class = "form-control" } })
Thank you so much for the help.