1

I want to populate a dropdownlist from a selected column of a table.

    [HttpGet]
    public ActionResult DeleteRole(RoleManager model)
    {
         //select all roleNames from db

           var getRole = from r in Session.Query<RoleManager>()
                      select r.roleName.ToList();


        return View(model);
    }

View:

    @Html.DropDownListFor(Model.roleName)

It is giving an error that No overload for method 'DropDownListFor' takes 1 arguments

Wasfa
  • 266
  • 5
  • 29
  • You need to passed the dictionary like (key,value) collection for DropDownListFor along with the model – Miller Oct 10 '13 at 11:11
  • @Html.DropDownListFor(m=> m.roleName, Model.roleName) this one also not works – Wasfa Oct 10 '13 at 11:17
  • possibly duplicate of http://stackoverflow.com/questions/7247871/binding-to-a-dropdownlist-in-mvc3 – Miller Oct 10 '13 at 11:18
  • Check this [Video](http://www.youtube.com/watch?v=k9CJmLbnFko‎) – AthibaN Oct 10 '13 at 11:23
  • see my answer here http://stackoverflow.com/questions/19145641/how-can-i-reuse-a-dropdownlist-in-several-views-with-net-mvc/19146077#19146077 – Matt Bodily Oct 11 '13 at 14:34

0 Answers0