码迷,mamicode.com
首页 > Web开发 > 详细

@Html.DropDownList

时间:2014-09-28 22:22:15      阅读:286      评论:0      收藏:0      [点我收藏+]

标签:style   blog   color   io   ar   sp   div   on   c   

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

标签:style   blog   color   io   ar   sp   div   on   c   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!