How to implement ASP. NET Upload progress bar

Source: Internet
Author: User

For the long-loaded ASP. NET page, we can display the progress bar in the client browser to show that the page is loading. Here is the specific implementation process:

Create a new project with the name Webportal, select a Visual C # project in the project type, or a Visual Basic project;
Select the ASP. NET Web application in the template type;
Position input: http://localhost/WebPortal;
Add New item: A Web Form with the name ShowProgress.
Add any additional Web server controls on your Web Forms showprogress.aspx.
Right-click on the showprogress.aspx, point to "View Code" and enter it at the top:
Visual C #. NET code

usingSystem.Threading; Visual Basic. NET code imports System.Threading in the Page_Load event: 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 ';d ots++;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 () ', +);}"); Response.Write ("function hidewait () {mydiv.style.visibility = ' hidden ';"); 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 ';d ots++;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 () ', +);}") Response.Write ("function hidewait () {mydiv.style.visibility= ' hidden ';") Response.Write ("window.clearinterval ();}") Response.Write ("startshowwait ();</script>") Response.Flush () Thread.Sleep (10000) in the HTML of the Showprogress.aspx form, enter:<script>hidewait ();</script>

Click to view in the browser

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.