C# 杂活

2021-04-26 18:25

阅读:388

标签:tostring   下拉框   use   html   open   nbsp   span   real   text   

1 下拉框

技术分享图片技术分享图片
List AcModel = BLL.Sys.AccountBLL.Instance.GetModelList("RoleID=3"); 
//实例化
// SelectList ServiceName = new SelectList(new List(), "ID", "RealName");

 //下拉框
SelectList ServiceName = new SelectList(AcModel, "ID", "RealName");
ViewData["ServiceName"] = ServiceName;

//页面显示
@Html.DropDownList("ServiceUserID", (SelectList)ViewData["ServiceName"], "全部")


List lists = new List();
lists.Add(new SelectListItem { Text = "未到期", Value ="0" });
lists.Add(new SelectListItem { Text = "到期已还", Value = "1" });
lists.Add(new SelectListItem { Text = "延期已还", Value = "2" });
lists.Add(new SelectListItem { Text = "未到期", Value = "3" });

 //for (int i = 1; i //{
 //    lists.Add(new SelectListItem { Text = i + "月", Value = i.ToString() });
 //}
 ViewBag.lists = lists;

//页面显示            
@Html.DropDownList("ServiceUserID", (List)ViewBag.lists)
MVC 下拉框

 

C# 杂活

标签:tostring   下拉框   use   html   open   nbsp   span   real   text   

原文地址:http://www.cnblogs.com/zhangtaotqy/p/7881634.html


评论


亲,登录后才可以留言!