0
我有一個月的下拉列表如下設置下拉列表中選擇值在剃刀
var month=new SelectList(
new List<SelectListItem>
{
new SelectListItem { Selected = true, Text = "All Months", Value = ""},
new SelectListItem { Selected = false, Text = "January", Value = "01"},
new SelectListItem { Selected = false, Text = "February", Value = "02"},
new SelectListItem { Selected = false, Text = "March", Value = "03"},
new SelectListItem { Selected = false, Text = "April", Value = "04"},
new SelectListItem { Selected = false, Text = "May", Value = "05"},
new SelectListItem { Selected = false, Text = "June", Value = "06"},
new SelectListItem { Selected = false, Text = "July", Value = "07"},
new SelectListItem { Selected = false, Text = "August", Value = "08"},
new SelectListItem { Selected = false, Text = "September", Value = "09"},
new SelectListItem { Selected = false, Text = "October", Value = "10"},
new SelectListItem { Selected = false, Text = "November", Value = "11"},
new SelectListItem { Selected = false, Text = "December", Value = "12"}
}, "Value" , "Text", 1);
@Html.DropDownList("drpMonth", @month, new { @class = "dropdown", @onchange = "OnDropdownChange(this.value,'month')", @selected = @ViewData["month"]})
如何設置選擇的值等於計算機[「月」]?
它解決了我的問題 – ghetal
這爐排@ ghetal。 – Ashiquzzaman