progressbar.htm
进度条显示页面(这个页面要引用上面那个进度条样式页面):
![](https://www.cnblogs.com/Images/OutliningIndicators/ContractedBlock.gif)
![](https://www.cnblogs.com/Images/OutliningIndicators/ExpandedBlockStart.gif)
<%@ Page Language="C#" enableSessionState ="True"%>
<%@ Import Namespace ="System.Data" %>
<%@ Import Namespace ="System.Threading" %>
<%@ Import Namespace ="System.IO" %>
<%@ Import Namespace ="System" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
protected void Page_Load(object sender, EventArgs e)
{
try
{
string strFileName = @"C:\Program Files\Common Files\microsoft shared\Web Server Extensions\12\TEMPLATE\LAYOUTS\domcool_progressbar.htm";
StreamReader sr = new StreamReader(strFileName, System.Text.Encoding.ASCII);
string strHtml = sr.ReadToEnd();
Response.Write(strHtml);
sr.Close();
Response.Flush();
Thread thread = new Thread(new ThreadStart(ThreadProc));
thread.Start();
thread.Join();
thread.Interrupt();
System.Web.HttpContext.Current.Response.Write("<script>window.location.href='';"+"</"+"script>");
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
}
private void ThreadProc()
{
string strScript = "<script>setPgb('pgbMain','{0}');"+"</"+"script>";
for ( int i = 0; i <= 100; i++ )
{
System.Threading.Thread.Sleep(5);
Response.Write( string.Format( strScript, i ) );
Response.Flush();
}
}
</script>
<html>
<head>
<META name="WebPartPageExpansion" content="full">
</head>
<body>
</body>
</html>