Using Kendo UI in MVC4 I have a Grid that makes Ajax calls for data back into the Controller:
<
If you need to display an error message from the server then you can do it by returning a DataSourceResult object with only its Errors property set:
return this.Json(new DataSourceResult
{
Errors = "my custom error"
});
And pick it up on the client by using this (referenced by the .Events(events => events.Error("onError"))
line):
function onError(e, status) {
if (e.status == "customerror") {
alert(e.errors);
}
else {
alert("Generic server error.");
}
}