标签:opd select collect trim val pre nbsp log drop
List<SelectListItem> ZH = new List<SelectListItem>(); ZH.Add(new SelectListItem { Text = "ZH1", Value = "ZH1" }); ZH.Add(new SelectListItem { Text = "ZH2", Value = "ZH2" }); ZH.Add(new SelectListItem { Text = "ZH3", Value = "ZH3" });
然后
<%= ViewData["ddl"] = ZH %>
最后展示
<%=Html.DropDownList("ddl")%>
后台通过Post,FormCollection取出数据
public ActionResult Index(FormCollection collection) { string zh = collection["ddl"] == null ? "" : collection["ddl"].Trim(); }
ASP.NET MVC中,前台DropDownList传值给后台。
标签:opd select collect trim val pre nbsp log drop
原文地址:http://www.cnblogs.com/D-sD/p/6134785.html