标签:for sp 数据 html bs new htm return nbsp
1.控制器中取得数据,构建SelectList,利用ViewData传值到View
//*****************得到所有部门名称*********//
List<string> names = dep_m_BLL.GetAllNames();
//*****************构建SelectList*********//
SelectList name = new SelectList(names);
ViewData["names"] = name;
return View();
2.在View中添加如下编码:
<%: Html.DropDownListFor(model => model.Inv_PP_Dep,(SelectList)ViewData["names"] ) %>
MVC中为Html.DropDownListFor()添加数据项
标签:for sp 数据 html bs new htm return nbsp
原文地址:http://www.cnblogs.com/zuimei/p/4054338.html