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

How to handle errors during ajax requests

1 Answer 45 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
saravanan k
Top achievements
Rank 1
saravanan k asked on 26 Apr 2010, 10:05 AM
Hi,

I am having an asp ajax update panel and rad loading panel. I am using the below code to show the loading panel during ajax requests. I have a timer which keeps polling a DB for a specific interval.

Situation:

If the page is inactive for a long time, the session expires, but the timer is still polling the DB. Due to the session expiry or due to some error from the server, a script error is thrown. How do i handle this in the below code?

 

<script>  
        var loadingPanel = "";  
        var pageRequestManager = Sys.WebForms.PageRequestManager.getInstance();  
        var postBackElement = "";  
        pageRequestManager.add_initializeRequest(initializeRequest);  
        pageRequestManager.add_endRequest(endRequest);  
 
 
        function initializeRequest(sender, eventArgs) {  
 
            loadingPanel = $find('<% = RadAjaxLoadingPanel1.ClientID %>');  
            postBackElement = eventArgs.get_postBackElement().id;  
            loadingPanel.show(postBackElement);  
            }  
 
 
        }  
 
        function endRequest(sender, eventArgs) {  
 
            loadingPanel = $find('<% = RadAjaxLoadingPanel1.ClientID %>');  
            loadingPanel.hide(postBackElement);  
 
 
        }  
</script> 

1 Answer, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 26 Apr 2010, 12:56 PM
Hello saravanan,

Please review the following help topic which elaborates on this matter.

I hope it helps.


All the best,
Maria Ilieva
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Ajax
Asked by
saravanan k
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Share this question
or