【发布时间】:2019-09-25 02:45:53
【问题描述】:
我是剑道 UI 的新手,目前正在学习自定义编辑器。 我的问题是我设法让我的编辑器模板在编辑模式下工作并很好地填充数据,但不知何故它不会将值保存到显示网格
我从 API 中检索所有数据。
更新: 我已经设法将自定义编辑器模板中的值正确保存到控制器,它工作得很好,但是使用 clientTemplate 不会显示我在下拉列表中选择的正确值,而只会显示一个字符串
DropDown Only Display A String
我的设置代码是这样的
@( Html.Kendo().Grid<SalesOrderDetailVM>()
.Name("list-detail")
.Columns(columns =>
{
columns.Bound(c => c.Product).ClientTemplate("\\#=Product.ProductId\\#").Title("Products");
columns.Bound(c => c.Quantity);
columns.Bound(c => c.UnitPrice);
})
.Editable(GridEditMode.InCell)
.ToolBar(tool =>
{
tool.Create();
tool.Save();
}
)
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(false)
.Batch(true)
.Model(model =>
{
model.Id(p => p.ProductId);
model.Field(p => p.Product);
})
.Create(act => act.Action("DetailCell_Create","SalesOrder"))
)
)
DDLProduct.cshtml:
@model AAF.WEB.MVC.ViewModels.ProductVM
@(
Html.Kendo().DropDownListFor(m => m)
.DataValueField("ProductId")
.DataTextField("ProductName")
.OptionLabel("Select Product")
.BindTo((System.Collections.IEnumerable)ViewData["products"])
)
【问题讨论】:
标签: asp.net-mvc asp.net-core kendo-ui kendo-grid telerik-grid