前台页码代码:

       <div style="margin:10px 5px;"><font color="red">当前角色:</font>@Html.DropDownList("RKEY", "-请选择角色-")</div>

 

后台数据绑定代码:

        public ActionResult Index()
        {
            ViewBag.RKEY = new SelectList(db.Roles, "RKEY", "RoleName");
            var rolesrights = db.RolesRights.Include(r => r.Roles).Include(r => r.BaseDatas);
            return View(rolesrights.ToList());
        }

效果:

   MVC4 @Html.DropDownList的用法

 

相关文章:

  • 2022-12-23
  • 2021-05-31
  • 2022-12-23
  • 2022-12-23
  • 2021-08-19
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-09-09
  • 2021-08-26
  • 2021-08-09
  • 2022-12-23
相关资源
相似解决方案