您知道如何轻松地将字符串数组的内容绑定到View MVC Razor中的DropDownList?将字符串数组绑定到MVC中的DropDownList Razor
public static string[] AgeRagne = new string[] { "Sun", "Mon", "Tues", "Wed" };
更新: 下面的代码工作。
@Html.DropDownListFor(
model => model.Filter.AgeRange,
new SelectList(Extensions.AgeRange, Model.Filter.AgeRange),
new { @class = "search-dropdown", name = "ageRange" }
)
我只是走真是疯狂的猜测..但你的意思是'AgeRange'而不是'AgeRagne'? => =>'.. string [] AgeRagne = ...' – 2016-08-02 02:15:33