@Html.DropDownList("ddlCountryCodes", (SelectList) ViewBag.CountryCodes)
Also, here is an example of hydrating the SelectList...
List<Country> countries = repository.ActiveCountryCodes();
ViewBag.CountryCodes = new SelectList(countries, "ERPCode", "Name", "");
Note that the four parameters are:
- the collection
- the getsetter on the POCO for the dropdown behind-the-scenes value
- the getsetter on the POCO for the dropdown public-facing value
- the setting itself
No comments:
Post a Comment