Kendo UI Network Management Error in MVC

I use the Kendo UI grid through the MVC Helper object. If an error occurs in the ajax call (i.e. the web server is unavailable), the request returns an error code, however, the Kendo user interface grid does not respond and simply continues to act as if the data were not being returned.

@(Html.Kendo().Grid<ProcessInformation>() .Name("Grid") {Edited for brevity} .DataSource(datasource => datasource.Ajax() .Read(read => read.Action("SearchProcesses", "SystemProcess") .Data("searchSerialize")) .PageSize(10) ).Name("ResultsGrid").Events(events => events.DataBound("gridOnBound"))) 

The MVC event is below:

 public ActionResult SearchProcesses( [DataSourceRequest] DataSourceRequest request, string startDate, string endDate, string status, int dataProcessType) { try { //does the search and returns the object } catch (Exception e) { this.log.ErrorException("Error Encountered in WebInternal.SearchProcesses()", e); var result = new JsonResult { Data = new { Redirect = "../Error/Unexpected" }, JsonRequestBehavior = JsonRequestBehavior.AllowGet }; return result; } } 

Is there a way for the Kendo UI grid to redirect a page to a page with an error on a failed call? I know that I can do this with an ajax call, but I would prefer to use the Kendo UI MVC Helper functionality.

Is there a way to do this as a global error handler that will apply to all ajax calls?

+4
source share
1 answer

To handle errors with the Kendo user interface network, consider this Kendo question : handling errors in Ajax data requests

You must add an event to the data source that will handle this error.

+5
source

Source: https://habr.com/ru/post/1498443/


All Articles