c# table 怎么在前台循环展示 ViewBag

后台    
public ActionResult DoctorEvaluation()//前台页面 { HE_Department HE_dt = new HE_Department(); DataTable dt = HE_dt.GetDepartment();
//表转list 不知道怎么转请看 例子:http://www.cnblogs.com/LZXX/p/7763613.html List
<Entitys.HE_Department> list = DataTableToList.ConvertTo<Entitys.HE_Department>(dt).ToList();      ViewBag.GetDepartmentList = list; //转化为LIST可以直接在前台循环 return View(); }
  前台
@foreach (var list in ViewBag.GetDepartmentList) { <li>@list.DepartmentName</li> }

 

posted @ 2018-04-17 11:58  12不懂3  阅读(1351)  评论(0编辑  收藏  举报
创作不易,请勿抄袭,欢迎转载!