I have a grid that I want to bind to local data. When I try to add a record, the widget tries to make an Ajax post back, instead of adding to the IEnumerable<T>.
I'm running ASP Dot Net Core 3.1 with Razor Pages and Telerik 2020.2.617
My Razor Page is as follows:
@(Html.Kendo().Grid<CreateModel.ModelItem>().Name(
"grid"
)
.AutoBind(
true
)
.BindTo((IEnumerable<CreateModel.ModelItem>)Model.Data.LineItems)
.Columns(cols =>
{
cols.Bound(c => c.Id);
cols.Bound(c => c.Line);
cols.Bound(c => c.Description);
cols.Bound(c => c.Qty);
cols.Bound(c => c.Value);
cols.Command(c =>
{
c.Edit();
c.Destroy();
});
})
.Editable(GridEditMode.InLine)
.Pageable()
.DataSource(ds=>
ds.Ajax()
.Batch(
false
)
.ServerOperation(
false
)
.Model(m=>
{
m.Id(id => id.Id);
m.Field(f => f.Id).DefaultValue(Guid.Empty);
m.Field(f => f.Line).DefaultValue(1);
m.Field(f => f.Description);
m.Field(f => f.Qty).DefaultValue(1);
m.Field(f => f.Value).DefaultValue(0.00m);
})
)
.ToolBar(t=>
{
t.Create().Text(
"Add Line Item"
);
t.Save();
})
)