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

AjaxRequest is fired AFTER the Page_Load

1 Answer 32 Views
AjaxLoadingPanel
This is a migrated thread and some comments may be shown as answers.
Rob Ainscough
Top achievements
Rank 1
Rob Ainscough asked on 14 Feb 2019, 04:56 PM

 

I went thru the sample here: https://docs.telerik.com/devtools/aspnet-ajax/controls/ajaxloadingpanel/how-to/show-ajaxloadingpanel-on-initial-page-load

... on how to get a "Loading Panel" to show on a Page_Load ... problem is the sample code doesn't work primarily because the AjaxRequest doesn't fire until AFTER the Page_Load completes making it useless for my needs.

In my Page_Load event I load some complex data from a SQL server and then bind to a grid, however the loading of the complex data can take anywhere from 3-5 seconds.  I need to present the user with a "Loading..." message "as the page loads".

I suppose I could move my long process into the AjaxRequest routine but is that the intended use?

Cheers, Rob.

1 Answer, 1 is accepted

Sort by
0
Accepted
Marin Bratanov
Telerik team
answered on 19 Feb 2019, 10:53 AM

Hi Rob,

The idea is, indeed, to keep the slow-loading part of the page Visible=false initially, then upon the AJAX request to set Visible=true to it and invoke any other slow processing, so all that slow work does not happen in the initial load and the user sees a loading panel while they are waiting for the slow stuff to happen. 

So, the initial Page_Load (that is, Page.IsPostBack === false) is expected to fire first, for the GET request for the page.

You can move the complicated code in an if-block that checks for the postback condition, for example, or in a handle for the AjaxRequest event of the Telerik control.


Regards,
Marin Bratanov
Progress Telerik
Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Tags
AjaxLoadingPanel
Asked by
Rob Ainscough
Top achievements
Rank 1
Answers by
Marin Bratanov
Telerik team
Share this question
or