How can I display the progress of an ASP. NET page that has been loaded for a long time in a 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?
For an Asp.net page that has been loaded for a long time, we can display a progress bar in the client browser to show that the page is being loaded. The specific implementation process is as follows:

Create a project named webportal. In the project type, select Visual C # project or visual basic project;
Select an ASP. NET web application from the template type Program ;
Enter: http: // localhost/webportal;
Add a new project: A web form named showprogress.
Add any other Web server controls on your web form showprogress. aspx.
Right-click showprogress. aspx and click "View ". Code ", Enter at the top:
Visual C #. Net code
Using system. Threading;

Visual Basic. Net code
Imports system. threading

In the page_load event, enter the Visual C #. Net code.
Response. Write ("<Div id = 'mydiv '> ");
Response. Write ("_");
Response. Write ("</div> ");
Response. Write ("<SCRIPT> mydiv. innertext =''; </SCRIPT> ");
Response. Write ("<script language = <a href =" http://dev.21tx.com/web/javascript/ "target =" _ blank "> JavaScript </a> ;");
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 = 'did ';");
Response. Write ("window. clearinterval ();}");
Response. Write ("startshowwait (); </SCRIPT> ");
Response. Flush ();
Thread. Sleep (10000 );

Visual Basic. Net code
Response. Write ("<Div id = 'mydiv '> ")
Response. Write ("_")
Response. Write ("</div> ")
Response. Write ("<SCRIPT> mydiv. innertext =''; </SCRIPT> ")
Response. Write ("<script language = <a href =" http://dev.21tx.com/java/ "target =" _ blank "> JAVA </a> SCRIPT> ;")
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 = 'did ';")
Response. Write ("window. clearinterval ();}")
Response. Write ("startshowwait (); </SCRIPT> ")
Response. Flush ()
Thread. Sleep (10000)

Enter:
<SCRIPT>
Hidewait ();
</SCRIPT>

Click View in the browser.
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.