In my view, all fields are binding to the model, except the dropdowns. The list gets populated, but the selected value is not set.
In my controller, I set the data source like this:
ViewBag.LocationID = new SelectList(db.Locations, "ID", "Name", model.LocationID);
In my view, I setup the dropdown like this:
@Html.DropDownListFor(model => model.LocationID, (SelectList)ViewBag.LocationID, string.Empty, htmlAttributes: new { @class = "form-control" })
In the questions that I read that had similar issues, the problem was that they weren't setting the selected value at the time of creating the SelectList, but I am doing that.
What's preventing the selected value from being bound by the model?