DropDownList View Model
Posted
by Jemes
on Stack Overflow
See other posts from Stack Overflow
or by Jemes
Published on 2010-04-30T10:37:18Z
Indexed on
2010/04/30
10:47 UTC
Read the original article
Hit count: 360
asp.net-mvc
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();
}
© Stack Overflow or respective owner