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

Show Dialog box to display CRUD operation error.

Thread ID:





133089 Oct 9,2017 08:36 AM UTC Oct 10,2017 12:13 PM UTC ASP.NET Core 1
Tags: Grid
Mahindra Morar
Asked On October 9, 2017 08:36 AM UTC

Do you have any examples on how to display the error returned from the controller when using the Datamanager - UrlAdaptor inside a Dialog control?

My sample code looks like this in the controller, and I want to display the value in the variable "errorMsg" inside a dialog control in the view.

 public async Task<ActionResult> Update([FromBody]CRUDModel<mdCurrency> value)

            var url = string.Format("{0}/{1}/{2}", URI_RESOURCE, value.Key, value.Value.Lockstamp);
            var response = await PutWSObjectAsync<mdCurrency, mdCurrencyResponse>(value.Value, url);

            var errorMsg = MessageFormatter.FormatCrudResults(response.CrudResults);    
            return null;


Mani Sankar Durai [Syncfusion]
Replied On October 10, 2017 12:13 PM UTC

Hi Mahindra, 

Thanks for contacting Syncfusion support. 

We have analyzed your query and based on your requirement we have prepared a sample that can be downloaded from the below link. 
In this sample we have thrown the error message from server side (controller) and shown the error message in dialog box.  This has been achieved using actionFailure event in grid.  
Refer the code example 
<ej-dialog id="ErrorList" title="Error" show-on-init="false"  close="onDialogClose"></ej-dialog> 
    <ej-grid id="FlatGrid" allow-paging="true" action-failure="failure"> 
        <e-filter-settings filter-type="Excel"></e-filter-settings> 
        <e-datamanager url="/Home/DataSource" update-url="/Home/NormalUpdate" insert-url="/Home/NormalInsert" remove-url="/Home/NormalDelete" adaptor="UrlAdaptor"></e-datamanager> 
        function failure(args) { 
            var error = $(args.error.responseText).eq(9).text();  //get the error message from server side. 
            str += "<tr><td>" + error + "</td></tr>"; 
            $('#ErrorList').html("<table>" + str + "</table>"); 
public ActionResult NormalUpdate([FromBody]CRUDModel<Order> myObject) 
            if(myObject.Value.EmployeeID > 9) 
            throw new Exception("EmployeeID must be above 1000"); 
        public ActionResult NormalInsert([FromBody]CRUDModel<Order> value) 
            if (value.Value.OrderID > 10000) 
                throw new Exception("OrderID must be above 1000"); 

From the above code example after the exception thrown from the server side the error has been retrieved using actionFailure event in grid. In the actionFailure event we have set the error message to the dialog html and open the dialog using dialog open method.  
Note: Initially we have set the dialog not visible using show-on-init property as false. 
Refer the documentation link. 

Refer the Kb link 

Please let us know if you need further assistance. 

Manisankar Durai. 


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

This page will automatically be redirected to the 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