惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Engineering at Meta
Engineering at Meta
博客园_首页
H
Help Net Security
WordPress大学
WordPress大学
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
罗磊的独立博客
博客园 - 三生石上(FineUI控件)
B
Blog
I
InfoQ
SecWiki News
SecWiki News
T
Tailwind CSS Blog
Spread Privacy
Spread Privacy
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
V
Vulnerabilities – Threatpost
N
Netflix TechBlog - Medium
P
Palo Alto Networks Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
Vercel News
Vercel News
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
K
Kaspersky official blog
M
MIT News - Artificial intelligence
S
Schneier on Security
T
Threat Research - Cisco Blogs
F
Fortinet All Blogs
Cyberwarzone
Cyberwarzone
Scott Helme
Scott Helme
aimingoo的专栏
aimingoo的专栏
Martin Fowler
Martin Fowler
MyScale Blog
MyScale Blog
The Cloudflare Blog
Recent Announcements
Recent Announcements
Security Latest
Security Latest
G
GRAHAM CLULEY
IT之家
IT之家
Y
Y Combinator Blog
The Last Watchdog
The Last Watchdog
腾讯CDC
Google DeepMind News
Google DeepMind News
V
V2EX
S
Securelist
TaoSecurity Blog
TaoSecurity Blog
B
Blog RSS Feed
S
SegmentFault 最新的问题
博客园 - 叶小钗
P
Proofpoint News Feed
云风的 BLOG
云风的 BLOG
Project Zero
Project Zero
G
Google Developers Blog
Google DeepMind News
Google DeepMind News
F
Full Disclosure

博客园 - Teracy

扫站:比较购物网站列表 MVC 2.0 学习笔记 和 Demo共享 网络书签的代码整理 2009年12月的工作发现 电子商务的认知 招聘Net软件工程师,网站设计师 sql2005数据库sa密码忘记了,该怎么办? 08年最后一天该说点什么了 邀请大家谈谈山寨版 工作小结 + 发布新的邮件发送工具 在ASP.NET中自动给URL地址加上超链接 把搜索引擎营销变成你的企业营销绩效飞跃重要策略 Google搜索引擎排名技巧 ASP.NET2.0实现无刷新客户端回调(热点技术) 工作记录 上班时间也要忙里偷闲 项目小结+Repeater中如何使用单选按钮 招聘Net软件工程师,测试工程师: 招聘ASP.NET技术人员
在ASP.NET中显示进度条-ASP.NET
Teracy · 2008-12-07 · via 博客园 - Teracy

对于加载时间比较长的ASP.NET页面,我们可以在客户端浏览器中显示进度条来显示页面正在装载。下面就是具体的实现过程:
  
  1.新建项目,名字为WebPortal,在项目类型中选择Visual C#项目或者Visual Basic项目都可;
  2.在模板类型中选择ASP.NET Web应用程序;
  3.位置里输入:http://localhost/WebPortal;
  4.添加新项:名字为ShowProgress的Web窗体。
  5.在您的Web窗体ShowProgress.aspx上添加任何其他的Web服务器控件。
  6.在ShowProgress.aspx上单击右键,点“查看代码”,在最上面输入:
  Visual C# .NET代码
  using System.Threading;
  
  Visual Basic .NET代码
  Imports System.Threading
  
  7.在Page_Load事件里输入: Visual C# .NET代码
  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 = '正在装载页面';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 = 'hidden';");
  Response.Write("window.clearInterval();}");
  Response.Write("StartShowWait();</script>");
  Response.Flush();
  Thread.Sleep(10000);
  
  Visual Basic .NET代码
  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 = '正在装载页面';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='hidden';")
  Response.Write("window.clearInterval();}")
  Response.Write("StartShowWait();</script>")
  Response.Flush()
  Thread.Sleep(10000)
  
  8.在ShowProgress.aspx窗体的html的中输入:
  <script>
  HideWait();
  </script>
  
  9.点在浏览器中查看即可。

本文转自 天涯技术网: www.yy0808.com ,更多详细的技术文章,大家也可以访问我的技术网.希望 www.yy0808.com 能为我们的技术人员带来帮助.