【问题标题】:Kendo UI - DropdownList in MVC Grid Edit/Create PopupKendo UI - MVC Grid Edit/Create Popup 中的 DropdownList
【发布时间】:2016-07-27 19:58:36
【问题描述】:

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

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; }

【问题讨论】:

    标签: razor kendo-ui kendo-grid kendo-asp.net-mvc


    【解决方案1】:

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

    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

    如果 Grid 配置为弹出式编辑,则 Html.EditorForModel 用于获取整个模型的编辑器 HTML。

    【讨论】:

      猜你喜欢
      • 2014-03-09
      • 1970-01-01
      • 2012-11-03
      • 2013-09-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多