DropDownList View Model
- by Jemes
I'm trying to produce a dropdownlist for GetAllRoles using the role provider.
I can produce the drop down in a controller using ViewData but I would like to use a View Model to produce the dropdown, but I'm unsure of the best way to create the list using a View Model?
public ActionResult GetAllRoles()
{
ViewData["Roles"] = new SelectList(Roles.GetAllRoles());
return View();
}