MVC的 @Html.DropDownList()的一种用法

前台代码

  @Html.DropDownList("SerialName", ViewBag.selList1 as IEnumerable<SelectListItem>, new { @class = "form-control"})

后台cs代码

  public ActionResult Login(string returnUrl)
        {
          ViewBag.selList1 = new SelectList(new String[] { "a", "b", "c" });         
          return View();
        }

这样直接可以

猜你喜欢

转载自blog.csdn.net/festone000/article/details/46318817