【发布时间】:2013-03-05 09:41:48
【问题描述】:
我正在尝试开发一个带有下拉列表的 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”引起的,有什么想法吗?
【问题讨论】:
标签: asp.net-mvc-4 webgrid