How to handle errors during ajax requests

2 posts, 0 answers
  1. saravanan k
    saravanan k avatar
    88 posts
    Member since:
    Mar 2010

    Posted 26 Apr 2010 Link to this post

    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> 

  2. Maria Ilieva
    Admin
    Maria Ilieva avatar
    4017 posts

    Posted 26 Apr 2010 Link to this post

    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.
Back to Top