デフォルトで選択された値http://www.mikesdotnetting.com/Article/202/Inline-Editing-With-The-WebGridでドロップダウンリストを使用して WebGrid を開発しようとしています。
// Controller 内のコード (複数のデータ セットを取得します):
ViewBag.material_codes = new SelectList(db.Master_Material, "material_code", "material_code");
//View(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」が原因だと思いますが、何かアイデアはありますか?