标签:style blog color io os ar sp div c
Dictionary<string, string> myDic = new Dictionary<string, string>(); myDic.Add(System.DBNull.Value.ToString(), "---"); myDic.Add("Male", "男"); myDic.Add("Female", "女"); //var items = new List<SelectListItem>() //{ // (new SelectListItem(){Text = "男", Value = "Male",Selected = false}), // (new SelectListItem(){Text = "女", Value = "female",Selected = true}) //}; @Html.DropDownList("sexList", ViewBag.sexList as List<SelectListItem>, new { @class = "l-text required",style = "width:86px;" }) //用 SelectList 可以生成 selected 效果。 SelectListItem 无效。 // 目前测试的结果是如果 SelectListItem 的 Value 是 integer 转换的可以。 为什么?????????????????
标签:style blog color io os ar sp div c
原文地址:http://www.cnblogs.com/starluck/p/4008929.html