我使用@Html.DropDownList()
制作了一个下拉列表
但它不是显示我的列表项,而是显示System.web.mvc,selectlist item
以下是代码:
@{
List<SelectListItem> listItems = new List<SelectListItem>();
listItems.Add(new SelectListItem
{
Text = "Department",
Value = "dep"
});
listItems.Add(new SelectListItem
{
Text = "Designation",
Value = "des",
Selected = true
});
}
@Html.DropDownList("Filter",
new SelectList(listItems.ToList()),
"Filter By:",
new { @class = "form-control" })