此代码对我不起作用:
<div class="col-md-4">
@Html.DropDownListFor(m => m.etattik,
new SelectList(new List<Object>
{
new { value = 0 , text="text1" },
new { value = 1 , text = "text2" },
new { value = 2 , text = "text3"}
})
)
@Html.ValidationMessageFor(m => m.etattik)
</div>
它显示了{ value = 0 , text=text1 }
答案 0 :(得分:0)
您没有为dataValueField
指定dataTextField
和SelectList
:
@Html.DropDownListFor(
m => m.etattik,
new SelectList(
new List<Object>{
new { value = 0 , text="text1" },
new { value = 1 , text = "text2" },
new { value = 2 , text = "text3"}
}
, "value", "text")
)
答案 1 :(得分:0)
检查
C:\symbol\wntdll.pdb\69DDFBCBBC14421D8CB974F8EDC414102\wntdll.pdb