对上一次的做一点修改,增加一个比较美观的进度显示
上面那个是运行中的画面,下面那个是结束后的画面
用到的图标在这里:
对上次的前台修改如下:
<%@ Page language="c#" Codebehind="WebForm54.aspx.cs" AutoEventWireup="false" Inherits="csdn.WebForm54" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm54</title>
<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
<meta content="C#" name="CODE_LANGUAGE">
<meta content="JavaScript" name="vs_defaultClientScript">
<meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema">
<style type="text/css">
.font { FONT-WEIGHT: normal; FONT-SIZE: 9pt; COLOR: #000000; FONT-FAMILY: "宋体", sans-serif; BACKGROUND-COLOR: #f0f0f0; TEXT-DECORATION: none }
</style>
</HEAD>
<body>
<form id="Form1" method="post" runat="server">
<div id="div_load" runat="server">
<table width="320" height="72" border="1" bordercolor="#cccccc" cellpadding="5" cellspacing="1"
class="font" style="FILTER: Alpha(opacity=80); WIDTH: 320px; HEIGHT: 72px">
<TR>
<TD>
<P><IMG alt="请等待" src="clocks.gif" align="left">
<BR>
<asp:Label id="lab_state" runat="server"></asp:Label></P>
</TD>
</TR>
</table>
<BR>
</div>
<asp:Button id="btn_startwork" runat="server" Text="运行一个长时间的任务"></asp:Button><BR>
<BR>
<asp:Label id="lab_jg" runat="server"></asp:Label>
</form>
</body>
</HTML>
后台修改如下:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
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 csdn
{
/// <summary>
/// WebForm54 的摘要说明。
/// </summary>
public class WebForm54 : System.Web.UI.Page
{
protected System.Web.UI.HtmlControls.HtmlGenericControl div_load;
protected System.Web.UI.WebControls.Button btn_startwork;
protected System.Web.UI.WebControls.Label lab_state;
protected System.Web.UI.WebControls.Label lab_jg;
protected work w;
private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
if(Session["work"]==null)
{
w=new work();
Session["work"]=w;
&nbs