博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
ASP.NET中进度条的简单应用
阅读量:4515 次
发布时间:2019-06-08

本文共 1608 字,大约阅读时间需要 5 分钟。

1  2  3     无标题页 4      27 28     29     
33 34

后台代码:

1 Default.aspx.cs: 2  3 using System; 4 using System.Data; 5 using System.Configuration; 6 using System.Web; 7 using System.Web.Security; 8 using System.Web.UI; 9 using System.Web.UI.WebControls;10 using System.Web.UI.WebControls.WebParts;11 using System.Web.UI.HtmlControls;12 using System.Threading;13 using System.IO;14 15 public partial class _Default : System.Web.UI.Page16 {17     private void beginProgress()18     {19         //根据ProgressBar.htm显示进度条界面20         string templateFileName = Path.Combine(Server.MapPath("."), "ProgressBar.htm");21         StreamReader reader = new StreamReader(@templateFileName,System.Text.Encoding.GetEncoding("GB2312"));22         string html = reader.ReadToEnd();23         reader.Close();24         Response.Write(html);25         Response.Flush();26     }27 28     private void setProgress(int percent)29     {30         string jsBlock = "";31         Response.Write(jsBlock);32         Response.Flush();33     }34 35     private void finishProgress()36     {37         string jsBlock = "";38         Response.Write(jsBlock);39         Response.Flush();40     }41 42     private void Page_Load(object sender, System.EventArgs e)43     {44         beginProgress();45 46         for (int i = 1; i <= 100; i++)47         {48             setProgress(i);49 50             //此处用线程休眠代替实际的操作,如加载数据等51             System.Threading.Thread.Sleep(50);52         }53 54         finishProgress();55     }56 }

 

 

转载于:https://www.cnblogs.com/ToFlying/p/3166370.html

你可能感兴趣的文章
Spring配置文件总结
查看>>
4.三角形面积
查看>>
基础-事务
查看>>
MAC下安装与配置MySQL [转]
查看>>
ERROR: ld.so: object '/usr/lib64/libtcmalloc.so.4' from LD_PRELOAD cannot be preloaded: ignored
查看>>
爬虫入门【10】Pyspider框架简介及安装说明
查看>>
android面试(4)---文件存储
查看>>
(转载) 标准C中的字符串操作函数
查看>>
如何提高android串口kernel log等级
查看>>
C#中值类型和引用类型的区别
查看>>
python学习笔记15-执行环境
查看>>
thinkphp 框架两种模式 两种模式:开发调试模式、线上生产模式
查看>>
iOS8中提示框的使用UIAlertController(UIAlertView和UIActionSheet二合一)
查看>>
Docker快速配置指南
查看>>
Python基础---OS模块 (二)
查看>>
【JS点滴】substring和substr以及slice和splice的用法和区别。
查看>>
awk多模式匹配
查看>>
线段树
查看>>
[javascript]实现登陆界面拖动窗口
查看>>
c++ queue类
查看>>