0

现在我是 MVC 的新手..请解决我的问题..谢谢提前

**This is MY View**

   @Html.DropDownList("SalutationName", (IEnumerable<SelectListItem>)ViewBag.Titles, "--------------Select-------------", new { id = "R_title" })


**This is My Controller**

  public ActionResult Index()
       {  var list=RoleID();
            IList<salutation> p = list;
            ViewBag.Titles = new SelectList(p.AsEnumerable(), "SalutationID", "SalutationName");
            return View();
        }
4

2 回答 2

1

尝试这个

@Html.DropDownList("Salutation",ViewBag.Titles as SelectList,"---select---",new { id = "R_title" })
于 2013-01-26T09:06:37.687 回答
0

尝试

@Html.DropDownList("SalutationName",ViewBag.Titles, "--------------Select-------------", new { id = "R_title" })
于 2013-01-25T13:29:40.583 回答