I'm having problems to add/edit/delete rows on a grid loaded from DataTable
I have something like the following code:
In the above code if I uncomment the "commented lines" .. the exception is:
"Templates can be used only with field access, property access, single-dimension array index, or single-parameter custom indexer expressions."
Could you tell me what I should do to enable CRUD operations on this case?
Thanks
I have something like the following code:
@(Html.Kendo().Grid<
object
>()
.HtmlAttributes(new { style = "height: 80%;" })
.Name("grid-records")
.Columns(columns =>
{
columns.LoadSettings(Model.GridColumns);
foreach (GridColumnSettings item in Model.GridColumns)
{
ModelFieldDescriptor modelField = new ModelFieldDescriptor();
modelField.Member = item.Member;
modelField.MemberType = item.MemberType;
modelField.DefaultValue = null;
modelField.IsEditable = true;
columns.Container.DataSource.Schema.Model.Fields.Add(modelField);
}
//columns.Command(command => { command.Edit(); command.Destroy(); }).HtmlAttributes(new { style = "float:right;" });
columns.Command(command => command.Custom("ViewDetails"));
})
.Groupable()
.Pageable()
.Sortable()
.Scrollable()
.Filterable(Web.Helpers.KendoI18n.SetGridFilterableSettings)
//.Editable(editable => editable.Mode(GridEditMode.InLine))
.DataSource(dataSource => dataSource
.Ajax()
.Events(events => events.Error("error_handler"))
.Read(read => read.Action("GetRecords", "Records", new { currentTableId = Model.CurrentTableId }))
//.Update(update => update.Action("UpdateRecordFromGrid", "Design"))
//.Destroy(destroy => destroy.Action("DeleteRecordFromGrid", "Design"))
)
)
"Templates can be used only with field access, property access, single-dimension array index, or single-parameter custom indexer expressions."
Could you tell me what I should do to enable CRUD operations on this case?
Thanks