I followed the example for Ajax custom errors and server side modelstate errors, however, the grid (inline editing) goes out of Edit Mode after my javascript error event is called.
We would like to leave the grid in error mode.
Not using .cancelChanges();
// javascript
function grid_error(e) {
var grid = $("#CPRProductLineGrid").data("kendoGrid");
var knotify = $("#popupNotification").data("kendoNotification");
if (e.errors) {
var message = "";
$.each(e.errors, function(key, value) {
if ('errors' in value) {
$.each(value.errors, function() {
message += this + "<br />";
});
}
});
knotify.show({
title: "Validation Error",
message: message
}, "error");
//grid.cancelChanges();
}
}
// controller
foreach (var item in validator.GetValidationErrors())
{
ModelState.AddModelError("GroupCode1", item);
}
return Json(ModelState.ToDataSourceResult());
We would like to leave the grid in error mode.
Not using .cancelChanges();
// javascript
function grid_error(e) {
var grid = $("#CPRProductLineGrid").data("kendoGrid");
var knotify = $("#popupNotification").data("kendoNotification");
if (e.errors) {
var message = "";
$.each(e.errors, function(key, value) {
if ('errors' in value) {
$.each(value.errors, function() {
message += this + "<br />";
});
}
});
knotify.show({
title: "Validation Error",
message: message
}, "error");
//grid.cancelChanges();
}
}
// controller
foreach (var item in validator.GetValidationErrors())
{
ModelState.AddModelError("GroupCode1", item);
}
return Json(ModelState.ToDataSourceResult());