Kendo UI - MVC 网格中的下拉列表 Edit/Create 弹出窗口

Kendo UI - DropdownList in MVC Grid Edit/Create Popup

我看过其他类似的问题,但似乎到目前为止我都做对了,但无济于事。 正如标题所述,对于我的一个专栏,我正在尝试使用下拉列表作为弹出窗口中的字段。

Index.cshtml:

    .Columns(columns =>
    {
           columns.Bound(p => p.DEPT_ID).Width("7%").Title("Dept/ Sector").EditorTemplateName("DeptDropdown");
           ...
    }

然后在/Views/Shared/EditorTemplates里面 DeptDropdown.cshtml:

 @model MVCFinalHope.Models.Version_Utility_Model
 @(Html.Kendo().DropDownListFor(m => m.DeptLookup )
    .Name("DEPT_ID")
    .DataValueField("DEPT_ID")
    .DataTextField("DEPT_ID")
    .BindTo(Model.DeptLookup)
)

然后在Version_Utility_Model.cs里面:

[UIHint("DeptDropdown")]
public List<V_TE_DEPT_LKUP> DeptLookup { get; set; }

独立的自定义字段编辑器在弹出式编辑模式下不起作用。您需要为整个编辑表单使用模板:

https://github.com/telerik/ui-for-aspnet-mvc-examples/tree/master/grid/custom-popup-editor

http://docs.telerik.com/kendo-ui/aspnet-mvc/helpers/grid/templating/editor-templates

If the Grid is configured for pop-up editing, the Html.EditorForModel is used to get the editor HTML for the whole model.