@Html.DropDownList

    //后台 
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>)

 

posted @ 2014-09-28 18:58  不能失败  阅读(427)  评论(0)    收藏  举报