I believe I have bound my data correctly, but I can\'t seem to get my text property for each SelectListItem to show properly.
My model:
public class
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 with the DropDownListFor
helper method
@Html.DropDownListFor(d=>d.SelectedLicenseName,
Model.LicenseNames.Items as List)
So when you post your form, you can inspect the SelectedLicenseName
property
[HttpPost]
public ActionResult Create(Licenses model)
{
//check model.SelectedLicenseName
}