Rank: Member Groups: Member
Joined: 3/11/2009 Posts: 24
|
I have a page that performs serveral operations to populate a grid before rendering the page. This process can take 5-10 seconds.
What is the best method for showing some type of "Please wait" dialog while the page_load method is performing its work? The one that you show on your demo site under dialog/input blocker would be perfect.
Thanks for your assistance.
Bryan Hunt
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi,
The key for such scenario is that any solution based on the assumption that the browser will display information before a page is fully received is unreliable. In reality, most browsers do try to display the page before the page is fully loaded. However it may suceed or fail. There also maybe additional cache modules on your server, or in between your server and client that decides to wait until it receives the full page before passing it down streams. IIS zip compression is a typical example --- it usually wait until it receives the full page before zipping it and passing it to the client.
This means if you wish to display "loadding" information to the client, such "loadding" information must be part of a fully loaded page. In another word, the page must be fully loaded with the "loading" information but without the Grid first. Once this initial page is loaded, you can then start to load the Grid, typically by triggering an AJAX call, for example, with our CallbackPanel. You can also use other method such as iframe or ASP.NET UpdatePanel. The exact steps are more of a personal preference. But the key is, the initial page must be fully loaded before you can worry about anything else.
Thanks!
|
Rank: Member Groups: Member
Joined: 3/11/2009 Posts: 24
|
Okay, I understand about the page_load needing to be complete.
I have added a callbackpanel and a dialog (triggered right now by a button) that works fine.
How can I trigger this to occur without user intervention? By using something like the Page.LoadComplete event?
Thanks.
|
Rank: Administration Groups: Administration
Joined: 5/27/2007 Posts: 24,194
|
Hi, If you use our CallbackPanel, you can either call eo_Callback JavaScript function to trigger the callback directly, or call _doPostBack to simulate the button click. If you use eo_Callback, you will not have the button click event on the server side. In that case you can check Callback.IsCallbackByMe in your Page_Load to determine whether you are handling an AJAX call so that you can load the Grid. There are various ways to call arbitary JavaScript code on page load. You can use body onload event, or place inline JavaScript directly inside the page. Details for this is beyond the scope of our support (we do not support generic programming questions). If all cases, you may want to avoid calling the target code directly and use setTimeout to delay the call instead. For example, instead of calling:
You can do:
Code: JavaScript
window.setTimeout(
function()
{
window.alert("Hi!");
}, 100);
This gives the browser more times to properly finishes up before your code is being called. Hope this helps. Thanks!
|