I want to show the stored values in dropdown as a selected value. I dont know how to do this in MVC.
My code is
<%: Html.DropDownList("basic-qualification-container" + i.ToString(),
new SelectList((IEnumerable<Dial4Jobz.Models.Degree>)ViewData["CandidateBasicQualifications"], "Id", "Name", (IEnumerable<int>)ViewData["BasicQualificationDegrees"]),
new { @class = "qualification" })%>
I select some option from dropdown and submit. After I load the page the last stored value will display. This is my problem.
DropDownList Helper in SomeAction View
You can show selected value with viewData like below.
Controller
And after post, you should set again viewData that is shown in selected value.