草庐IT

NewsItemId

全部标签

c# - Html.DropDownList 所选值不起作用(将构造函数与 IEnumerable<SelectListItem> 一起使用)

我有一个问题,即所选值不适用于Html.DropDownList帮助器方法。见下文:这是我的Controller:publicActionResultEdit(intid=0){NewsEventitem=GetItem(id);ViewBag.NewsItemId=newSelectList(ViewBag.NewsItemId.Items,"Id","Name",item.NewsItemId);returnView(item);}这是我的观点:@Html.DropDownList("NewsItemId",ViewBag.NewsItemIdasSelectList,string

c# - Html.DropDownList 所选值不起作用(将构造函数与 IEnumerable<SelectListItem> 一起使用)

我有一个问题,即所选值不适用于Html.DropDownList帮助器方法。见下文:这是我的Controller:publicActionResultEdit(intid=0){NewsEventitem=GetItem(id);ViewBag.NewsItemId=newSelectList(ViewBag.NewsItemId.Items,"Id","Name",item.NewsItemId);returnView(item);}这是我的观点:@Html.DropDownList("NewsItemId",ViewBag.NewsItemIdasSelectList,string