我正在尝试使用下拉列表开发一个 WebGrid,默认情况下,选定的值http://www.mikesdotnetting.com/Article/202/Inline-Editing-With-The-WebGrid
//Controller 中的代码(抓取超过 1 组数据):
ViewBag.material_codes = new SelectList(db.Master_Material, "material_code", "material_code");
//视图中的代码(WebGrid):
grid.Column("material_code", MenuItemModel.translateMenuItem("MaterialCode"), format:
@<text>
@Html.DropDownList("material_code", (SelectList)ViewBag.material_code, item.material_code)
</text>),
但是我得到了错误:
Error 1 'System.Web.Mvc.HtmlHelper<IMv3.ViewModels.RMReceivingViewModels>' has no applicable method named 'DropDownList' but appears to have an extension method by that name. Extension methods cannot be dynamically dispatched. Consider casting the dynamic arguments or calling the extension method without the extension method syntax.
我相信这是由“item.material_code”引起的,有什么想法吗?