Following is my grid.
@(Html.Kendo().Grid<VehicleUploadViewModel>()
.Name("grid")
.Resizable(resize => resize.Columns(true))
.Columns(columns =>
{
columns.Bound(p => p.ID).Visible(false);
columns.Bound(p => p.RefId).Width(15);
columns.Bound(p => p.IsAcceptReturn).Width(15).ClientTemplate("<input type='checkbox' #= IsAcceptReturn ? 'checked=checked' : '' #></input>");
columns.Bound(p => p.ReturnDuration).Width(15);
columns.Bound(p => p.CurrentSellingMethodId).Width(15);
columns.Bound(p => p.SuggestedOfferPrice).Width(15);
columns.Bound(p => p.Summary).Width(15);
})
.ToolBar(toolbar =>
{
toolbar.Save();
})
.Pageable(p => p.Refresh(true))
.Sortable()
.Editable(editable => editable.Mode(GridEditMode.InCell))
.Scrollable(scrollable => scrollable
.Height(366))
.Filterable()
.Groupable()
.Navigatable()
.HtmlAttributes(new { style = "width:1138px;" })
.Selectable(selectable => selectable.Mode(GridSelectionMode.Single))
.Reorderable(reorder => reorder.Columns(true))
.DataSource(dataSource => dataSource
.Ajax()
.Batch(true)
.PageSize(10)
.ServerOperation(false)
.Events(events => events
.Error("error_handler")
.RequestEnd("onRequestEnd"))
.Model(model =>
{
model.Id(p => p.ID);
})
.Read(read => read.Action("UploadRead", "Upload"))
.Update(update => update.Action("Editing_Update", "Upload")))
.Events(e => e.DataBound("onDataBound").Cancel("onCancel"))
)
In my script tag, following is the code. I am assigning a blank source to the kendo grid on document ready.
<script>
var grid;
$(document).ready(function () {
grid = $("#grid").data("kendoGrid");
grid.dataSource.data([]);
});
function onUploadSuccess(e) {
{
grid.dataSource.data(e.response.Data);
}
</script>
Following is the code from my action result which gives new data source to grid in onUploadSuccess function.
var request = new DataSourceRequest();
return this.Json(lstUploadVehicles.ToDataSourceResult(request));
Now, the new data is bounded in the grid, I am able to edit the records. But SaveChange is not called.
Here is my save method
[AcceptVerbs(HttpVerbs.Post)]
public ActionResult Editing_Update([DataSourceRequest] DataSourceRequest request, [Bind(Prefix = "models")]IEnumerable<VehicleUploadViewModel> vehicleUpload)
{
}
Why I am not able to call save changes method?