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

Setting a timer after page is finished loading

2 Answers 242 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Tony
Top achievements
Rank 1
Tony asked on 25 Mar 2010, 08:28 PM
I have a site that loads data intensive charts that take a while to generate.  In order to improve the user's experience, we opted to load the page (minus the charts), then fire an ajax call to begin loading the charts at that time.  Currently it is simply being done by a Timer whose Interval is set to 1 sec.

This works responsibly well on most machines.  However, we started having some errors where splitters would not resize initially, menus would not load completely etc.  For the most part the behaviour was random and worse on some machines.

I realized that the JS was not completly loading before the timer was kicking off.  The timer was killing the current runing js files.

So I changed the timer to a 5 sec delay and everything worked as adversied.

So my question is: Is there an event that gets fired once all of the Telerik JS is finished loading?  If I could tie into that, I could enable my timer at eliminate the generic 5 sec wait time for most users.

Thanks for any advice.
Tony

2 Answers, 1 is accepted

Sort by
0
robertw102
Top achievements
Rank 1
answered on 25 Mar 2010, 08:54 PM
I think you should handle the jQuery load event and then execute your timer. Like so:

$(window).load(new function() { startTime();});

I hope that helps.
0
SamJ
Top achievements
Rank 1
answered on 28 Mar 2010, 09:35 AM
Hi Tony,

You can hook up the pageLoad client-side event which is fired after the page is fully loaded and all client-side objects of the controls are finished initializing.

Check the below articles:
http://www.telerik.com/help/aspnet-ajax/ajxshowloadingpaneloninitialpageload.html
http://blogs.telerik.com/dimodimov/posts/08-12-13/don_t_use_body_onload_in_asp_net_ajax_websites.aspx

I hope this helps.

SamJ
Tags
Ajax
Asked by
Tony
Top achievements
Rank 1
Answers by
robertw102
Top achievements
Rank 1
SamJ
Top achievements
Rank 1
Share this question
or