对于加载时间比较长的ASPNET页面我们可以在客户端浏览器中显示进度条来显示页面正在装载下面就是具体的实现过程
新建项目名字为WebPortal在项目类型中选择Visual C#项目或者Visual Basic项目都可
在模板类型中选择ASPNET Web应用程序
位置里输入//localhost/WebPortal
添加新项名字为ShowProgress的Web窗体
在您的Web窗体ShowProgressaspx上添加任何其他的Web服务器控件
在ShowProgressaspx上单击右键点查看代码在最上面输入
Visual C# NET代码
using SystemThreading;
Visual Basic NET代码
Imports SystemThreading
在Page_Load事件里输入 Visual C# NET代码
ResponseWrite(<div id=mydiv >);
ResponseWrite(_);
ResponseWrite(</div>);
ResponseWrite(<script>mydivinnerText = ;</script>);
ResponseWrite(<script language=javascript>;);
ResponseWrite(var dots = ;var dotmax = ;function ShowWait());
ResponseWrite({var output; output = 正在装载页面;dots++;if(dots>=dotmax)dots=;);
ResponseWrite(for(var x = ;x < dots;x++){output += ·;}mydivinnerText =output;});
ResponseWrite(function StartShowWait(){mydivstylevisibility = visible; );
ResponseWrite(windowsetInterval(ShowWait());});
ResponseWrite(function HideWait(){mydivstylevisibility = hidden;);
ResponseWrite(windowclearInterval();});
ResponseWrite(StartShowWait();</script>);
ResponseFlush();
ThreadSleep();
Visual Basic NET代码
ResponseWrite(<div id=mydiv >)
ResponseWrite(_)
ResponseWrite(</div>)
ResponseWrite(<script>mydivinnerText = ;</script>)
ResponseWrite(<script language=javascript>;)
ResponseWrite(var dots = ;var dotmax = ;function ShowWait())
ResponseWrite({var output; output = 正在装载页面;dots++;if(dots>=dotmax)dots=;)
ResponseWrite(for(var x = ;x < dots;x++){output += ·;}mydivinnerText =output;})
ResponseWrite(function StartShowWait(){mydivstylevisibility = visible; )
ResponseWrite(windowsetInterval(ShowWait());})
ResponseWrite(function HideWait(){mydivstylevisibility=hidden;)
ResponseWrite(windowclearInterval();})
ResponseWrite(StartShowWait();</script>)
ResponseFlush()
ThreadSleep()
在ShowProgressaspx窗体的html的中输入
<script>
HideWait();
</script>
点在浏览器中查看即可