Implementation of ASP. Net upload progress bar

Source: Internet
Author: User

For ASP. NET pages that have 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;
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, click "view code", and enter:
Visual C #. NET code

Using System. threading; Visual Basic. NET code Imports System. threading in the Page_Load event, enter: Visual C #. NET code 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 (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 = 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 = 'visable'; ") Response. write ("window. setInterval ('showwait () ', 1000);} ") Response. write ("function HideWait () {mydiv. style. visibility = 'hiddy'; ") Response. write ("window. clearInterval ();} ") Response. write ("StartShowWait (); </script>") Response. flush () Thread. sleep (10000) in ShowProgress. input in the html of the aspx form: <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.