All articles| All Pictures| All Softwares| All Video| Go home page| Write articles| Upload pictures

Reading number is top 10 articles
2003,下,IIS+PHP+MySQL+Zend,Optimizer+GD库+phpMyAdmin安装配置_php资料_编程技术
PHP学习宝典-第七章(续篇)_[PHP教程]
SQL Server 2008安装过程图解_[SQL Server教程]
千万级数据分页之二---一个简单的自定义分页控件_[Asp.Net教程]
Silverlight,2(beta1)数据操作(7)—调用FlickR,REST,APIs来询图片_[Asp.Net教程]
自己在做项目过程中学到的PHP知识收集_php资料_编程技术
十天学会ASP.net,第四天_.net资料_编程技术
打造超酷的PHP数据饼图_[PHP教程]
SQL,Server,数据库连接字符串的声明_[SQL,Server教程]
delphi在文本文件中添加一行
Reading number is top 10 pictures
运动的范冰冰3
29 the belle stars after bath figure3
China railway shunting skills competition
你的钱干净吗?
性感丰满身材火爆de美女1
人美胸美腿更美3
The hot big eye big breast beauty2
南昌铁路局宜春车务段攸县车站铁路职工福利房被开发商侵占
Take you to walk into the most true north Korea rural3
So beauty, will let you spray blood5
Download software ranking
C++教程第四版
Professional killers2 data package
WebService在.NET中的实战应用教学视频 → 第2集
网络管理员第三版
Jinling thirteen stock
Tram sex maniac 2 (H) rar bag1
Eclipse-CALMSANNY (second edition)
matrix1
Tram sex maniac 2 (H) rar bag7
The hero
归海一刀 published in(发表于) 2014/1/30 0:59:55 Edit(编辑)
ASP.NET实现进度条_[Asp.Net教程]

ASP.NET实现进度条_[Asp.Net教程]

ASP.NET实现进度条_[Asp.Net教程]























在网上查阅了很多相关资料,参照对比一番后自己整理了一下,做了个小例子。能够实现根据后台数据加载的进度在前台动态更新进度条、进度条在页面居中显示、在进度条内显示百分比,完成进度后隐藏进度条。个人感觉还是有一定的参考价值,贴出来先。




建立一个WEB工程,添加新项->HTML页面,命名为ProgressBar.htm,内容如下:














无标题页



























后台代码,Default.aspx.cs:











using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Threading;
using System.IO;

public partial class _Default : System.Web.UI.Page
{
private void beginProgress()
{
//根据ProgressBar.htm显示进度条界面
string templateFileName = Path.Combine(Server.MapPath("."), "ProgressBar.htm");
StreamReader reader = new StreamReader(@templateFileName,System.Text.Encoding.GetEncoding("GB2312"));
string html = reader.ReadToEnd();
reader.Close();
Response.Write(html);
Response.Flush();
}

private void setProgress(int percent)
{
string jsBlock = "";
Response.Write(jsBlock);
Response.Flush();
}

private void finishProgress()
{
string jsBlock = "";
Response.Write(jsBlock);
Response.Flush();
}

private void Page_Load(object sender, System.EventArgs e)
{
beginProgress();

for (int i = 1; i <= 100; i++)
{
setProgress(i);

//此处用线程休眠代替实际的操作,如加载数据等
System.Threading.Thread.Sleep(50);
}

finishProgress();
}
}






前台页面代码在此省略,可以放置任意控件。














































添加到del.icio.us 添加到新浪ViVi 添加到百度搜藏 添加到POCO网摘 添加到天天网摘365Key 添加到和讯网摘 添加到天极网摘 添加到黑米书签 添加到QQ书签 添加到雅虎收藏 添加到奇客发现 diigo it 添加到饭否 添加到飞豆订阅 添加到抓虾收藏 添加到鲜果订阅 digg it 貼到funP 添加到有道阅读 Live Favorites 添加到Newsvine 打印本页 用Email发送本页 在Facebook上分享


Disclaimer Privacy Policy About us Site Map

If you have any requirements, please contact webmaster。(如果有什么要求,请联系站长)
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.