首页 > Web开发 > 详细

@Html.DropDownList

时间:2014-09-28 20:40:06      阅读:335      评论:0      收藏:0      [点我收藏+]
    //后台 
public ActionResult OrderAdd() { var items = new List<SelectListItem>() { (new SelectListItem(){Text = "", Value = "Male"}), (new SelectListItem(){Text = "", Value = "female"}) }; ViewBag.sexList = items; return View(); }
//前端

//默认为空
@Html.DropDownList("sexList", ViewBag.sexList as  List<SelectListItem>,"")

//默认为第一个值,也就是 "男"
@Html.DropDownList("sexList", ViewBag.sexList as List<SelectListItem>)

 

@Html.DropDownList

原文:http://www.cnblogs.com/starluck/p/3998833.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!