If I create and then immediately update, it will not have ID and treat the update as new insert and will show error message of "javascript runtime error: unable to get property 'ID' of undefined or null reference."
If I create and then immediately delete, same error message and it will not delete the data as it has no new inserted id.
But I can update or delete if the grid is refreshed by refreshing the web page. What did I miss?
<%: Html.Kendo().Grid<zProvince>()
.Name("GridProvince")
.Columns(columns =>
{
columns.Bound(o => o.ProvinceName).Title("Name");
columns.Bound(o => o.empgroupName).Title("empgroupName");
columns.Bound(o => o.ID).Hidden();
columns.Command(command => { command.Edit(); command.Destroy(); }).Width(180);
})
.ToolBar(commands => commands.Create())
.Editable(editable => editable.Mode(Kendo.Mvc.UI.GridEditMode.InLine))
.DataSource(dataSource => dataSource
.Ajax()
.Model(model => model.Id(p => p.ID))
.Read(read => read.Action("GetProvince", "Admin"))
.Create(create => create.Action("CreateProvince", "Admin"))
.Update(update => update.Action("UpdateProvince", "Admin"))
.Destroy(destroy => destroy.Action("DestroyProvince", "Admin"))
)
.Events(events => events
.Change("change"))
.Selectable(s => s.Mode(Kendo.Mvc.UI.GridSelectionMode.Single))
.Scrollable()
.Pageable()
%>
If I create and then immediately delete, same error message and it will not delete the data as it has no new inserted id.
But I can update or delete if the grid is refreshed by refreshing the web page. What did I miss?
<%: Html.Kendo().Grid<zProvince>()
.Name("GridProvince")
.Columns(columns =>
{
columns.Bound(o => o.ProvinceName).Title("Name");
columns.Bound(o => o.empgroupName).Title("empgroupName");
columns.Bound(o => o.ID).Hidden();
columns.Command(command => { command.Edit(); command.Destroy(); }).Width(180);
})
.ToolBar(commands => commands.Create())
.Editable(editable => editable.Mode(Kendo.Mvc.UI.GridEditMode.InLine))
.DataSource(dataSource => dataSource
.Ajax()
.Model(model => model.Id(p => p.ID))
.Read(read => read.Action("GetProvince", "Admin"))
.Create(create => create.Action("CreateProvince", "Admin"))
.Update(update => update.Action("UpdateProvince", "Admin"))
.Destroy(destroy => destroy.Action("DestroyProvince", "Admin"))
)
.Events(events => events
.Change("change"))
.Selectable(s => s.Mode(Kendo.Mvc.UI.GridSelectionMode.Single))
.Scrollable()
.Pageable()
%>