开发者

Simple way to show loading page indicator on ASP.net

I working with ASP.net and I am wondering if there is a simple way to show "Page Loadin开发者_如何学编程g" message until the page finishes to load.

Thanks.


As far as I know, no.

ASP.NET final HTML will be sent to the browser only after it has finished execution.. unlike classic ASP command like Response.Flush will won't have the desired effect of seeing the text/image before the page loads.

There are some ways around though. If the page is target of previous page, have the previous page open small pop up saying "loading" and close that pop up with script in the "heavy" page.

Another way around is having the "heavy" code taking time to run asynchronously in separate thread, then in the main thread show only the "Please wait" and have the separate thread hide that message once done.


That's kind of the purpose of the spinning wheels in the various browsers...

You could separate out some of your content into various update panels and leverage ajax to make calls to populate those panels.


Take a look at the UpdatePanel and UpdateProgress server controls as a starting point. Wrapping your form in an UpdatePanel will allow the form to postback asynchronously and associating an UpdateProgress control with a particular UpdatePanel will allow you to present the user with a message as the asynchronous request is being processed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜