8图河畔家园:在 Asp.Net Web 应用程序中长时间装载页面时显示进度条
来源:百度文库 编辑:偶看新闻 时间:2024/04/27 21:42:20
在 Asp.Net Web 应用程序中长时间装载页面时显示进度条,虽然是假进度条,不能实时反映装载进度,但是可以告诉用户页面正在装载,以免用户误以为系统故障或死机。
新建一个 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
Default
进入
Progressbar.aspx (HTML)
<%@ Page language="c#" Codebehind="Progressbar.aspx.cs" AutoEventWireup="false" Inherits="WebApp.Progressbar" %>
进度条
http://schemas.microsoft.com/intellisense/ie5">
<% string strUrl=Request.Params["U"];%>
border="0">
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;
新建一个 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
进入
Progressbar.aspx (HTML)
<%@ Page language="c#" Codebehind="Progressbar.aspx.cs" AutoEventWireup="false" Inherits="WebApp.Progressbar" %>
http://schemas.microsoft.com/intellisense/ie5">
<% string strUrl=Request.Params["U"];%>
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
{
///
/// Second 的摘要说明。
///
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: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
///
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
///
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
}
}
common.css
.bi-loading-status {
/*position: absolute;*/
在VS.NET2003中,无法创建asp.net web应用程序
vs.net2003在创建ASP.NET WEB应用程序时
为什么我在visual studio.net中用c#建立ASP.NET WEB应用程序不行?
VS.NET中建不了ASP.NET Web应用程序
vs.net 2003 asp.net web应用程序出现服务器错误
vs.net不能创建ASP.NET WEB应用程序 急!!!!!!
新建ASP.NET WEB应用程序后,启动时(F5):报无法在 Web 服务器上启动调试。
我在运行Asp.NET web应用程序时.建不了项目.提示说计算机上没有运行web服务器。请先启动web服务器
在打开Asp.net web应用程序时出现以下提示是怎么回事:Microsoft Internet Explorer 为脱机状态,
ASP.NET Web.config?
Visual Studio .NET新建ASP.NET Web 应用程序项目时以下错误如何解决?
.NET中建不了ASP.NET Web应用程序!!急!谁能告诉我。谢谢!
vs.net 2005用c#怎么写asp.net web应用程序
asp.net应用程序问题
创建asp.net web应用程序的时候,怎么弹出说asp.net 不是1.1版本,是什么原因呢
选择V C#项目,选择打开asp.net WEB应用程序会出错是什么意思
正确的ASP.NET WEB应用程序,运行后页面空白,没有任何显示,这是怎么回事
基于vb 开发的asp.net web 应用程序如何用代码连接数据库
VS2005 新建项目模版中为什么没有"asp.net web应用程序"这一项
开发ASP.NET Web应用程序的问题。希望高手帮助一下
在ASP.NET中如何控制WEB打印?
在vs.net2003中,新建asp.net web 应用程序时 提示 cannot load "fp4Awel.dll" 然后自动推出,该怎么解决
asp.net 新建web窗体
用visult C#.net平台下选用ASP.NET Web应用程序时能选择自己的路径么?