This is a migrated thread and some comments may be shown as answers.

Error handling with RadAjaxManager

2 Answers 296 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Suresh
Top achievements
Rank 1
Suresh asked on 26 Jan 2012, 01:46 AM
I am using RadAjaxManagerProxy in my user control and RadAjaxManager in the master page and a RadAjaxLoadingPanel. When an error occurs server side, the loading panel hides and does not show any error message. How can I show an error message when an ajax request fails.

2 Answers, 1 is accepted

Sort by
0
Accepted
Antonio Stoilkov
Telerik team
answered on 30 Jan 2012, 07:11 PM
Hi Suresh,

You could check out the Error Handling For Ajax Requests help article below for handling errors when ajax is enabled. Additionally, you could implement some custom logic by wrapping the code that throws an error in try-catch block and showing the error message.

Regards,
Antonio Stoilkov
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
0
Suresh
Top achievements
Rank 1
answered on 31 Jan 2012, 09:12 PM
<script type="text/javascript">
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
 
function EndRequestHandler(sender, args) {
        if (args.get_error() != undefined) {
            var objError = args.get_error();
            args.set_errorHandled(true);
            showMessage({ messageType: 'error', message: objError.message });
        }
    }
</script>
Above script did it for me, Thanks.
Tags
Ajax
Asked by
Suresh
Top achievements
Rank 1
Answers by
Antonio Stoilkov
Telerik team
Suresh
Top achievements
Rank 1
Share this question
or