0
我怎樣才能得到dropdownlist的選擇值,這裏是我的代碼工作正常。在asp.net MVC獲取dropdownlist的選定值
var list = new[] {
new Person { Id = 1, Name = "Name1" },
new Person { Id = 2, Name = "Name2" },
new Person { Id = 3, Name = "Name3" }
};
var selectList = new SelectList(list, "Id", "Name", 2);
ViewData["People"] = selectList;
<%= Html.DropDownListFor(model => model.Peoples, ViewData["People"] as IEnumerable<SelectListItem>)%>