我们只要在aspx页面上加一个DIV一个button就可以来实现就可以达到目的, DIV设置如下:
<div id="divOver" runat="server" style="Z-INDEX: 12000; LEFT: 0px; WIDTH: 160; CURSOR: wait; POSITION: absolute; TOP: 0px; HEIGHT: 100">
<table style="17%; height:10%;">
<tr>
<td>
<table width="169" style="WIDTH: 160px; HEIGHT: 62px">
<tr align="center" valign="middle">
<td>交易正在处理中<br />Please waiting</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<table style="17%; height:10%;">
<tr>
<td>
<table width="169" style="WIDTH: 160px; HEIGHT: 62px">
<tr align="center" valign="middle">
<td>交易正在处理中<br />Please waiting</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
然后在后台代码中加上下面代码:
protected void Page_Load(object sender, EventArgs e)
{
//注册button1的onclick事件
this.Button1.Attributes.Add("onclick", "javascript:document.getElementById('divOver').style.visibility='visible';");
//运行先把这个DIV隐藏起来
divOver.Style.Add("visibility", "hidden");
}
//button单击后会发生一次页面postback,预呈现里面添加把div隐藏
protected override void OnPreRenderComplete(EventArgs e)
{
divOver.Style.Add("visibility", "hidden");
}
protected void Button1_Click(object sender, EventArgs e)
{
//预设button业务处理为5S
Thread.Sleep(5000);
}
{
//注册button1的onclick事件
this.Button1.Attributes.Add("onclick", "javascript:document.getElementById('divOver').style.visibility='visible';");
//运行先把这个DIV隐藏起来
divOver.Style.Add("visibility", "hidden");
}
//button单击后会发生一次页面postback,预呈现里面添加把div隐藏
protected override void OnPreRenderComplete(EventArgs e)
{
divOver.Style.Add("visibility", "hidden");
}
protected void Button1_Click(object sender, EventArgs e)
{
//预设button业务处理为5S
Thread.Sleep(5000);
}