How to display the progress of ASP. NET pages loaded for a long time in the client browser

Source: Internet
Author: User

How can I display the progress of an ASP. NET page that has been loaded for a long time in a client browser? Add the loading prompt in the page_load event...

Introduction: using system. Threading;

In the page_load event, enter:

Response. Write ("<Div Id = 'mydiv' >");
                Response. Write ("_");
                Response. Write ("</Div> ");
                Response. Write ("<SCRIPT> mydiv. innertext = ''; </SCRIPT>");
                Response. Write ("<Script Language = JavaScript>;");
                Response. Write ("Var Dots = 0; var Dotmax = 10; Function Showwait ()");
                Response. Write ("{VaR Output; Output = 'Loading page'; DOTS ++; If (DOTS> = dotmax) DOTS = 1;");
                Response. Write ("For (VAR X = 0; x < Dots; X ++) {output + = '.';} Mydiv. innertext =   Output ;}");
                Response. Write ("Function Startshowwait () {mydiv. style. Visibility = 'Visible '; ");
                Response. Write ("Window. setinterval ('showwait () ', 1000 );}");
                Response. Write ("Function Hidewait () {mydiv. style. Visibility = 'Ddn ';");
                Response. Write ("Window. clearinterval ();}");
                Response. Write ("Startshowwait (); </SCRIPT> ");
                Response. Flush ();
                Thread. Sleep (20000 );

On the. ASPX page, enter

&lt;script&gt;HideWait();&lt;/script&gt;
From: http://blog.sina.com.cn/s/blog_4efce4d10100cimv.html
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.