Use the Items
property of your LicenseNames
property, which is of type SelectList
@Html.DropDownList("SelectedLicenseName", new SelectList(Model.LicenseNames.Items, "Value", "Text", Model.LicenseNames.SelectedValue))
Or using the DropDownListFor
helper method
@Html.DropDownListFor(d=>d.SelectedLicenseName, Model.LicenseNames.Items as List<SelectListItem>)
So when you publish your form, you can check the SelectedLicenseName
property
[HttpPost] public ActionResult Create(Licenses model) {
source share