【发布时间】:2014-01-17 01:08:43
【问题描述】:
我创建了一个带有动态对象的网格,我想使用 GridEditMode.InLine 来更新和添加数据。弹出模式正在工作,但使用 InCell 和 内联我收到以下错误:
模板只能用于字段访问、属性访问、单维数组索引或单参数自定义索引器表达式。
我错过了什么吗?
我尝试使用自定义模板,但仍然遇到同样的错误。
感谢您的帮助
@(Html.Kendo().Grid<dynamic>()
.Name("Grid")
.DataSource(dataSource => dataSource
.Ajax()
.ServerOperation(true)
.Model(cfg =>
{
cfg.Id("SsdID");
foreach (var property in Model.PropertyDescriptors)
{
cfg.Field(property.Name, property.DataType);
}
})
.Read(cfg => cfg.Type(HttpVerbs.Post)
.Action("ReadDataForDefinition", "ManualDataEntry",
new { id = Model.LDefinitionId }))
.Update(u => u.Type(HttpVerbs.Post).Action("UpdateDataForDefinition","ManualDataEntry",
new { id = Model.LDefinitionId }))
.Create(u => u.Type(HttpVerbs.Post).Action("Create", "ManualDataEntry",
new { id = Model.LDefinitionId }))
)
.Resizable(resizing => resizing.Columns(true))
Columns(columns =>
{
foreach (var property in Model.PropertyDescriptors.Where(desc => desc.DisplayOrder.HasValue))
{
var binding = columns.Bound(property.DataType, property.Name);
if (property.DataType == typeof(DateTime) || property.DataType ==typeof(DateTime?))
binding.Format("{0:d}");
binding.Column.Title = property.Label;
}
columns.Command(command =>
{
command.Edit();
command.Destroy();
});
})
.ToolBar(toolbar => { toolbar.Create(); })
.Pageable(paging =>
{
paging.ButtonCount(10);
paging.PreviousNext(true);
paging.PageSizes(true);
})
.Editable(edit => edit.Mode(GridEditMode.InLine))
.Sortable()
.Scrollable()
.Filterable()
)
【问题讨论】:
标签: asp.net-mvc dynamic grid kendo-ui inline-editing