【发布时间】:2011-03-06 19:25:49
【问题描述】:
我使用 asp.net mvc 2,但 DropDownListFor 助手有问题。 我的 ViewModel 包含一个 SelectList,其中包含所有必需的值和 1 个 SelectedValue。 当我在视图中使用 DropDownListFor 助手时,未选择 SelectedValue! 然后我选择另一个值并提交表单,在选定的 PostedValue 中的下一次渲染中。第一次渲染有什么问题?
<%=Html.LabelFor(m => m.Test)%>
<%=Html.DropDownListFor(m => m.Test, Model.TestList, new { tabindex = 1, @class = "selectbox" })%>
<%=Html.ValidationMessageFor(m => m.Test, null, new {@class = "text-hide", id = "Error-Test"})%>
【问题讨论】:
标签: asp.net-mvc drop-down-menu