乡下人产国偷v产偷v自拍,国产午夜片在线观看,婷婷成人亚洲综合国产麻豆,久久综合给合久久狠狠狠9

  • <output id="e9wm2"></output>
    <s id="e9wm2"><nobr id="e9wm2"><ins id="e9wm2"></ins></nobr></s>

    • 分享

      在 Asp.Net Web 應用程序中長時間裝載頁面時顯示進度條

       荷露叮咚 2007-05-25
      在 Asp.Net Web 應用程序中長時間裝載頁面時顯示進度條,雖然是假進度條,不能實時反映裝載進度,但是可以告訴用戶頁面正在裝載,以免用戶誤以為系統(tǒng)故障或死機。
        新建一個 Web 項目,添加4個文件:Default.htm;Progressbar.aspx;Second.aspx;
      common.css。
        Default.htm 頁面有一個超鏈,點擊之后先裝載 Progressbar.aspx,裝載完之后裝載 Second.aspx,因為 Second.aspx 模擬大頁面所以 Page_Load 中主線程掛起 10 秒鐘,其間仍顯示進度條頁面 Progressbar.aspx。


        代碼如下:


      Default.htm
      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
      <html>
      <head>
      <title>Default</title>
      <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
      <meta name=ProgId content=VisualStudio.HTML>
      <meta name=Originator content="Microsoft Visual Studio .NET 7.1">
      </head>
      <body>
       <a href="Progressbar.aspx?U=Second.aspx">進入</a>
      </body>
      </html>


      Progressbar.aspx (HTML)
      <%@ Page language="c#" Codebehind="Progressbar.aspx.cs" AutoEventWireup="false" Inherits="WebApp.Progressbar" %>
      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
      <HTML>
       <HEAD>
        <title>進度條</title>
        <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
        <meta name="CODE_LANGUAGE" Content="C#">
        <meta name="vs_defaultClientScript" content="JavaScript">
        <meta name="vs_targetSchema" content="
      http://schemas.microsoft.com/intellisense/ie5">
        <link rel="stylesheet" type="text/css" href="common.css" />
        <% string strUrl=Request.Params["U"];%>
        <META http-equiv=Refresh content="0;URL= <%=strUrl%> ">
        <script language="javascript">
         var i = 0;
         
         function setPgb(pgbID, pgbValue)
         {
          if ( pgbValue <= 100 )
          {
           if (lblObj = document.getElementById(pgbID+‘_label‘))
           {
            lblObj.innerHTML = pgbValue + ‘%‘; // change the label value
           }
            
           if ( pgbObj = document.getElementById(pgbID) )
           {
            var divChild = pgbObj.children[0];
             
            pgbObj.children[0].style.width = pgbValue + "%";
           }
            
           window.status = "數(shù)據(jù)讀取" + pgbValue + "%,請稍候...";
          }
           
          if ( pgbValue == 100 )
           window.status = "數(shù)據(jù)讀取已經(jīng)完成";
         }
         
         function showBar()
         {
          setPgb(‘pgbMain‘,i);
          i++;
         }
        </script>
       </HEAD>
       <BODY onload="setInterval(‘showBar()‘,100)">
        <TABLE id="Table1" style="WIDTH: 760px" cellSpacing="0" cellPadding="0" align="center"
         border="0">
         <TR height="400">
          <TD vAlign="middle" align="center">
           <DIV class="bi-loading-status" id="proBar" style="LEFT: 425px; WIDTH: 300px; TOP: 278px; HEIGHT: 44px">
            <DIV class="text" id="pgbMain_label" align="left"></DIV>
            <DIV class="progress-bar" id="pgbMain" align="left">
             <DIV style="WIDTH: 10%"></DIV>
            </DIV>
           </DIV>
          </TD>
         </TR>
        </TABLE>
       </BODY>
      </HTML>


      Second.aspx(code-behind)
      using System;
      using System.Collections;
      using System.ComponentModel;
      using System.Data;
      using System.Drawing;
      using System.Web;
      using System.Web.SessionState;
      using System.Web.UI;
      using System.Web.UI.WebControls;
      using System.Web.UI.HtmlControls;

      namespace WebApp
      {
       /// <summary>
       /// Second 的摘要說明。
       /// </summary>
       public class Second : System.Web.UI.Page
       {
        private void Page_Load(object sender, System.EventArgs e)
        {
         // 在此處放置用戶代碼以初始化頁面


         System.Threading.Thread.Sleep(10000);
        }


        #region Web 窗體設計器生成的代碼
        override protected void OnInit(EventArgs e)
        {
         //
         // CODEGEN: 該調(diào)用是 ASP.NET Web 窗體設計器所必需的。
         //
         InitializeComponent();
         base.OnInit(e);
        }
        
        /// <summary>
        /// 設計器支持所需的方法 - 不要使用代碼編輯器修改
        /// 此方法的內(nèi)容。
        /// </summary>
        private void InitializeComponent()
        {   
         this.Load += new System.EventHandler(this.Page_Load);


        }
        #endregion
       }
      }


      common.css
      .bi-loading-status {


        /*position:   absolute;*/

        本站是提供個人知識管理的網(wǎng)絡存儲空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點。請注意甄別內(nèi)容中的聯(lián)系方式、誘導購買等信息,謹防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請點擊一鍵舉報。
        轉(zhuǎn)藏 分享 獻花(0

        0條評論

        發(fā)表

        請遵守用戶 評論公約

        類似文章 更多