CS1928: 'System.Web.Mvc.HtmlHelper' does not contain a definition for 'DropDownList' and the best extension method overload 'System.Web.Mvc.Html.SelectExtensions.DropDownList(System.Web.Mvc.HtmlHelper, string, string)' has some invalid arguments
I am getting the user roles form the memebership provider and then asking the user to select the role. the roles are in a dropdown list on the register page.
public ActionResult ChangePassword()
{
ViewData["PasswordLength"] = MembershipService.MinPasswordLength;
var roles = Roles.GetAllRoles().ToList();
ViewData["Roles"] = new SelectList(roles);
return View();
}
<p>
<%= Html.DropDownList("Userrole",((SelectList)ViewData["Roles"]).Items,"--Select One---") %>
</p>