显示更新进度(方法1)
来源:互联网 发布:申请阿里云服务器 编辑:程序博客网 时间:2024/05/16 12:30
效果图
1.aspx页面
html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title></title>
<script src="TankInvt.js" type="text/javascript"></script>
<link href="Stylesheet1.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Button Text ="ceshi" runat ="server" ID ="ceshi"
onclick="ceshi_Click" style="margin-bottom: 0px" />
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
>
<asp:ListItem>111</asp:ListItem>
<asp:ListItem>22</asp:ListItem>
<asp:ListItem>33</asp:ListItem>
<asp:ListItem>444</asp:ListItem>
</asp:DropDownList>
<asp:Button ID="ddlbut" runat="server"
onclick="ddlbut_Click" Text="Button" style=" display :none" />
<asp:TextBox ID="TextBox1" runat="server" AutoPostBack="True" ></asp:TextBox>
<asp:Button ID="txtbut" runat="server" onclick="txtbut_Click" Text="Button" style=" display :none" />
<div id="main">
<div style="z-index: 1; position: absolute; width: 300px;left: 400px; top: 200px;background-color:window;display:none;" id="loadinfo">
<span style=" color: Green ; font-size: 16px; font-weight: bold" >正在处理数据 loading...</span></div>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<br />
</div>
</form>
</body>
</html>
2.cs页面
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication12
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
this.ceshi.Attributes.Add("onclick", "return Showloadinfo();");
this.DropDownList1.Attributes.Add("onchange", "return Showloadinfo1();");
this.TextBox1.Attributes.Add("onchange", "return Showloadinfo3();");
}
protected void ceshi_Click(object sender, EventArgs e)
{
long num=0;
for (int i = 1; i < 10; i++)
{
System.Threading.Thread.Sleep(100);
num += i;
}
this.Label1.Text = num.ToString();
//Response.Write("<script language='javascript'>alert('保存成功!');</script>");
ScriptManager.RegisterStartupScript(this.ceshi, this.GetType(), "alertScript", "Closeloadinfo();", true);
// ScriptManager.RegisterStartupScript(this.ceshi, this.GetType(), "alertScript", "AlertSuccess();", true);
//
// ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>AlertSuccess();</script>");
}
protected void ddlbut_Click(object sender, EventArgs e)
{
long num = 0;
for (int i = 1; i < 10; i++)
{
System.Threading.Thread.Sleep(500);
num += i;
}
this.Label1.Text = num.ToString();
this.Label1.Text = this.DropDownList1.SelectedItem.Text +"---"+this.DropDownList1.SelectedItem.Value ;
ScriptManager.RegisterStartupScript(this.DropDownList1 , this.GetType(), "alertScript", "Closeloadinfo();", true);
}
protected void txtbut_Click(object sender, EventArgs e)
{
long num = 0;
for (int i = 1; i < 10; i++)
{
System.Threading.Thread.Sleep(500);
num += i;
}
this.Label1.Text = num.ToString();
this.Label1.Text = this.TextBox1 .Text ;
ScriptManager.RegisterStartupScript(this.TextBox1 , this.GetType(), "alertScript", "Closeloadinfo();", true);
}
}
}
3.js 页面
function Showloadinfo() {
self.document.getElementById("loadinfo").style.display = "inline";
self.document.getElementById("main").disabled = true;
}
function Showloadinfo1() {
self.document.getElementById("loadinfo").style.display = "inline";
self.document.getElementById("main").disabled = true;
document.getElementById("ddlbut").click();
}
function Showloadinfo2() {
self.document.getElementById("loadinfo").style.display = "inline";
self.document.getElementById("main").disabled = true;
document.getElementById("txtbut").click();
}
function Closeloadinfo() {
self.document.getElementById("loadinfo").style.display = "none";
self.document.getElementById("main").disabled = false;
}
注:当要在下拉表控件和文本控件改变时添加进度条 使用的方法
- 显示更新进度(方法1)
- 我来更新下进度(1)
- ajax分批更新,动态显示进度
- Android提示版本更新+notification显示下载进度
- Android中使用Notification实现应用更新显示下载进度
- App更新进度显示在后台通知栏详解
- Android 简单实现app通知栏更新及显示进度
- ionic2检测下载更新代码及进度百分比显示问题
- C#下载文件并显示显示进度的方法实现
- 我来更新下进度(2)
- 我来更新下进度(3)
- 任务进度规划(每日更新)
- Unity3d 基础学习进度(每日更新)
- WPF ProgressBar显示进度(一)
- WPF ProgressBar显示进度(二)
- WPF ProgressBar显示进度(三)
- WPF ProgressBar显示进度(四)
- WPF ProgressBar显示进度(五)
- Java GUI编程的基础知识
- js与c# 之间数据和方法交互
- MaxScript——动画关联表达式
- linux下面使用du
- 从今天开始,记录自己的学习历程!
- 显示更新进度(方法1)
- 制作证书
- centos 下mysql5.1.45 二进制版本安装及多apache php版本安装
- jschart 绘制动态图
- 学习一下 呵呵
- linux忘記root密碼
- 周末两天加班
- 开通了博客哦
- 两数组最短距离 acm