你知道我可以很容易地将字符串数组的内容绑定到 MVC Razor 视图中的 DropDownList 吗?
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" }
)