0
这有什么问题?下拉问题
<%=Html.DropDownListFor(m=>m.Client,null,"Select",new { @style = "width: 630px" })%>
有一个计算机[“客户”],其contanins源,下拉填充但没有选择对应于Model.Client
这有什么问题?下拉问题
<%=Html.DropDownListFor(m=>m.Client,null,"Select",new { @style = "width: 630px" })%>
有一个计算机[“客户”],其contanins源,下拉填充但没有选择对应于Model.Client
更改ViewDate [“客户端”]至计算机[值“ClientList”]并将其替换为null。不要忘记将其转换为SelectList。
<%=Html.DropDownListFor(m=>m.ClientId,(SelectList)ViewData["ClientList"],"Select",new { @style = "width: 630px" })%>
希望这会有所帮助。
查看此链接以获得最佳实践:http://odetocode.com/Blogs/scott/archive/2010/01/18/drop-down-lists-and-asp-net-mvc.aspx – ali62b 2010-01-29 16:09:34