We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. (Last updated on: November 16, 2018).
Unfortunately, activation email could not send to your email. Please try again.
Syncfusion Feedback

How to display custom error message on AJAX action failture

Thread ID:





123776 Apr 20,2016 02:33 PM UTC Apr 21,2016 10:39 AM UTC ASP.NET MVC 1
Tags: Grid
Eric Outley
Asked On April 20, 2016 02:33 PM UTC

I.m trying to display an error message after an update error on the grid.  I'm using the RemoteSaveAdaptor and found some information on the forum on how to do this (https://www.syncfusion.com/kb/5170/how-to-display-custom-error-message-on-ajax-action-failture).  I set the event ActionFailure on the grid, but having a few issues.

To test out everything, I just throw an error (throw new Exception("TEST");) in the controller and the event was fired, but I cannot see any why to get the error message from the event.  If I use the responseText, I get the html from the error page and the statusText says "Internal Server Error".  Is there any way to get the text from the error that was thrown.

Secondly, it seems like the ajax call never completes.  The spinner is still shown and now of the button on the grid is clickable.  

The java script for the function is as follows:

    function grid_ShowFailure(args) {


Jayaprakash Kamaraj [Syncfusion]
Replied On April 21, 2016 10:39 AM UTC

Hi Eric,

Thanks for contacting Syncfusion support.

We are able to get the text from the error that was thrown using ActionFailure event. This event triggers for every grid action server failure event.

We were able to face the issue with waiting popup shown and CRUD operations not reverted when action fails at server side. So, we have logged the requirement as an issue and a support incident has been created under your account to track the status of this requirement. Please log on to our support website to check for further updates. 


As of now, use the below workaround in order to handle this issue. In this workaround, we have used cancelEdit method to stop editing/adding. If waiting popup is displayed in your sample while any server sider action gets failed, we can hide waiting popup manually using hide method of ejWaitingPopUp. Please refer to the following code example, screenshot, help documents and sample.


         .Datasource(ds => ds.Json((IEnumerable<object>)ViewBag.dataSource).UpdateURL("/Grid/Update").InsertURL("/Grid/Insert").RemoveURL("/Grid/Delete").Adaptor(AdaptorType.RemoteSaveAdaptor))


        .EditSettings(edit => { edit.AllowAdding().AllowDeleting().AllowEditing(); })

            .ToolbarSettings(toolbar =>


                toolbar.ShowToolbar().ToolbarItems(items =>










        .Columns(col =>


            col.Field("OrderID").HeaderText("Order ID").IsPrimaryKey(true).TextAlign(TextAlign.Right).Width(90).ValidationRules(v => v.AddRule("required", true).AddRule("number", true)).Add();

            col.Field("EmployeeID").HeaderText("Employee ID").TextAlign(TextAlign.Right).Width(90).ValidationRules(v => v.AddRule("required", true)).Add();




        .ClientSideEvents(eve => { eve.ActionFailure("Failure"); })  


<script type="text/javascript">

    function Failure(args) {

        var popupObj = $("#FlatGrid").data("ejWaitingPopup");



        var str = "";

        str = $(args.error.responseText).find('i').text();



public ActionResult Update(EditableOrder value)


            throw new Exception("TEST");


            var data = OrderRepository.GetAllRecords();

            return Json(data, JsonRequestBehavior.AllowGet);

Help document for actionFailure: http://help.syncfusion.com/js/api/ejgrid#events:actionfailure

Help document for cancelEdit: http://help.syncfusion.com/js/api/ejgrid#methods:canceledit

Help document for waitingpopoup: http://help.syncfusion.com/js/api/ejwaitingpopup#methods:hide

Sample: http://www.syncfusion.com/downloads/support/forum/123776/ze/Sample118221-376676842


Jayaprakash K.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

Please sign in to access our forum

or the page will be automatically redirected to sign-in page in 10 seconds.

Warning Icon You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.Close Icon