4

我想在KendoUi網格中使用EditorTemplateName作爲外鍵列。Kendoui MVC EditorTemplateName在PopUp編輯模式下不起作用

當網格編輯模式是InLine時,所有的東西都可以,我的模板已加載。但是當更改模式爲Popup時無法加載模板。 如何解決它?

@(Html.Kendo().Grid<Product>() 
    .Name("grid") 
    .Columns(columns => 
    { 
     columns.Bound(p => p.ProductId).Visible(false); 
     columns.Bound(p => p.Title); 

     columns.ForeignKey(p => p.CategoryId, new SelectList(ViewBag.CategoryySelectList, "Value", "Text")) 
        .EditorTemplateName("MyTemplate"); 

     columns.Command(cmd => cmd.Edit()); 
    }) 
    .Editable(edit => edit 
     .Mode(GridEditMode.PopUp) 
    ) 
    .DataSource(dataSource => dataSource 
     .Ajax() 
     .PageSize(15) 
     .Events(events => events.Error("error_handler")) 
     .Model(model => 
     { 
      model.Id(p => p.ProductId); 
     }) 
     .Read(read => read.Action("FillGrid", "Products")) 
     .Update(update => update.Action("Edit", "Products")) 
     .Destroy(destroy => destroy.Action("Delete", "Products")) 
    ) 
) 

回答

相關問題