Base solution for your next web application
Open Closed

Ajax error dialog #3106


User avatar
0
PhilWynn created

Hi, I have successfully integrated the Kendo grid into aspnet zero. Now I would like to be able to handle ajax errors consistently with the rest of the application. Please could you tell me how I could invoke the standard abp ajax error dialog from within my javascript. I am successfully catching server side errors here, and am simply looking for the best way to report them.

Thank you


6 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    How you are using it? Did you add [DontWrapResult] attribute to your actions? Are you using abp.ajax or kendo automatically calls actions via ajax? Which version and frameworks (asp.net core, mvc 5...) you are using?

  • User Avatar
    0
    PhilWynn created

    Hi,

    I am using the current MVC5 jQuery version. I do indeed apply the [DontWrapResult] attribute to my action methods to get this working. Kendo automatically calls the ajax methods required and I am therefore unable to use abp.ajax . However, I would really like to maintain consistency in the way I handle ajax errors.

    The code below shows how I use Kendo to set up a datasource. Where I have the TODO comment, I would like to be able to invoke the standard abp ajax error dialog:

    function buildDataSource() {
                return new kendo.data.DataSource({
                    type: "aspnetmvc-ajax",
                    transport: {
                        read: {
                            url: "/Users/GetUsers",
                            data: {
                                filterText: $('#UsersTableFilter').val()
                            }
                        }
                    },
                    schema: {
                        data: 'data',
                        total: 'total',
                        errors: 'error'
                    },
                    error: function (e) {
                        //TODO
                        //alert(e.errors.message); 
                    },
                    pageSize: 10,
                    serverPaging: true,
                    serverSorting: true
                });
            }
    
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    Have you tried abp.ajax.showError('error message') ?

  • User Avatar
    0
    PhilWynn created

    Thanks, that was what I was looking for.

    Is the javascript API documented anywhere?

  • User Avatar
    0
    alirizaadiyahsi created

    Hi,

    Documents are here: <a class="postlink" href="https://aspnetboilerplate.com/Pages/Documents/Handling-Exceptions">https://aspnetboilerplate.com/Pages/Doc ... Exceptions</a> <a class="postlink" href="https://aspnetboilerplate.com/Pages/Documents/Javascript-API/Message">https://aspnetboilerplate.com/Pages/Doc ... PI/Message</a> <a class="postlink" href="https://aspnetboilerplate.com/Pages/Documents/Javascript-API/AJAX">https://aspnetboilerplate.com/Pages/Doc ... t-API/AJAX</a>

  • User Avatar
    0
    PhilWynn created

    Fantastic. Thanks for the help..