zoukankan
html css js c++ java
对于长时间装载的ASP.NET页面,如何在客户端浏览器中显示进度?
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;
using
System.Threading;
namespace
Exercise
...
{
/**/
///
<summary>
///
WebForm2 的摘要说明。
///
</summary>
public
class
WebForm2 : System.Web.UI.Page
...
{
private
void
Page_Load(
object
sender, System.EventArgs e)
...
{
//
对于长时间装载的ASP.NET页面如何在客户端浏览器中显示进度?
//
对于加载时间比较长的ASP.NET页面,
//
我们可以在客户端浏览器中显示进度条来显示页面正在装载。下面就是具体的实现过程:
if
(
!
IsPostBack)
...
{
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();
for
(
long
i
=
0
;i
<
99999999999
;i
++
) i
=
i
++
;
//
or Thread.Sleep(10000);
}
}
Web 窗体设计器生成的代码
#region
Web 窗体设计器生成的代码
override
protected
void
OnInit(EventArgs e)
...
{
//
//
CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base
.OnInit(e);
}
/**/
///
<summary>
///
设计器支持所需的方法 - 不要使用代码编辑器修改
///
此方法的内容。
///
</summary>
private
void
InitializeComponent()
...
{
this
.Load
+=
new
System.EventHandler(
this
.Page_Load);
}
#endregion
}
}
<%
...
@ Page language
=
"
c#
"
Codebehind
=
"
WebForm2.aspx.cs
"
AutoEventWireup
=
"
false
"
Inherits
=
"
Exercise.WebForm2
"
%>
<!
DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
>
<
HTML
>
<
HEAD
>
<
title
>
WebForm2
</
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"
>
<
script
language
="javascript"
>
...
HideWait();
</
script
>
</
HEAD
>
<
body
MS_POSITIONING
="GridLayout"
>
<
form
id
="Form1"
method
="post"
runat
="server"
>
</
form
>
</
body
>
</
HTML
>
查看全文
相关阅读:
centos下使用yum 安装pip
unity3d Aniso Level 摄像机近地面清楚,远地面模糊
Unity3D 多平台 预编译 宏定义
Mecanim的Avater
Mecanim 学习概述
Unity物理系统的触发器
Unity开发 资源准备
我的Unity学习路线
贴图在Unity中的设置
在Unity中为模型使用表情
原文地址:https://www.cnblogs.com/happyday56/p/1363413.html
最新文章
项目团队建设
python基础-模块
Python基础-三次用户验证登录购买商品程序
python基础-修改haproxy配置文件
python基础-装饰器
python基础-函数式编程
python基础-文件操作
python基础-迭代器和生成器
python基础-内置函数详解
Python基础-字符串格式化_百分号方式_format方式
热门文章
基本数据类型-集合(set)_上周内容回顾(字符串_数字_列表_元组_字典_集合)
centos7使用MariaDB(转)
substr在oracle和mysql中的应用和区别
JDBC:深入理解PreparedStatement和Statement
spring boot eclipse 下pom文件第一行报unknown错
postgrelsql 的 wm_concat : string_agg
mysql to_char to_number
dubbo、dubbox、motan、thrift、grpc等RPC框架比较及选型
RPC框架是啥?
mysql出现“ You can't specify target table '表名' for update in FROM clause”解决方法
Copyright © 2011-2022 走看看