色尼玛亚洲综合影院,亚洲3atv精品一区二区三区,麻豆freexxxx性91精品,欧美在线91

asp.net UpdaeProgress的簡單用法

UpdateProgress 應該就是“更新進度” 的意思吧。
使用方法:
1.添加一個ScriptManager控件
2.添加一個UpdatePanel控件
3.添加一個UpdateProgress控件
設置UpdateProgress控件的AssociatedUpdatePanelID為第2步 UpdatePanel的ID(如果頁面中有多個UpdatePanel則,只有相應updatePanel關聯的updateProgress顯示)
測試例子代碼: 
復制代碼 代碼如下:
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.ASPx.cs" Inherits="_Default" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Untitled Page</title>
<style type="text/css">
#UpdatePanel1, #UpdatePanel2, #UpdateProgress1 {
border-right: gray 1px solid; border-top: gray 1px solid;
border-left: gray 1px solid; border-bottom: gray 1px solid;
}
#UpdatePanel1, #UpdatePanel2 {
width:200px; height:200px; position: relative;
float: left; margin-left: 10px; margin-top: 10px;
}
#UpdateProgress3 {
width: 200px; background-color: #FFC080;
bottom: 0%; left: 0px; position: absolute;
}
#UpdateProgress2 {
width: 200px; background-color: #FFC080;
bottom: 0%; left: 0px; position: absolute;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<ASP:ScriptManager ID="ScriptManager1" runat="server" />
<ASP:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<ASP:Button ID="Button1" runat="server" OnClick="Button1_Click1" Text="Button" />
<ASP:Label ID="Label1" runat="server" Text="顯示數據"></ASP:Label>
<ASP:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
<ProgressTemplate>
<div id="progress"><img src="img/1.gif" />
等待中...
</div>
</ProgressTemplate>
</ASP:UpdateProgress>
</ContentTemplate>
</ASP:UpdatePanel>
<ASP:UpdatePanel ID="UpdatePanel2" runat="server">
<ContentTemplate>
<ASP:Button ID="Button2" runat="server" OnClick="Button2_Click1" Text="Button" /><br />
<br />
<ASP:Label ID="Label2" runat="server" Text="顯示數據"></ASP:Label>
<ASP:UpdateProgress ID="UpdateProgress2" runat="server" AssociatedUpdatePanelID="UpdatePanel2">
<ProgressTemplate>
更新數據中....
</ProgressTemplate>
</ASP:UpdateProgress>
</ContentTemplate>
</ASP:UpdatePanel>
</form>
</body>
</html>

c#代碼:
復制代碼 代碼如下:
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;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click1(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(3000);
Label1.Text = "刷新時間:" + DateTime.Now.ToString();
}
protected void Button2_Click1(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(3000);
Label2.Text = "刷新時間:" + DateTime.Now.ToString();
}
}

其中,頁面代碼中的css是msdn上的例子。UpdatePanel1中的UpdateProgress1顯示一張動態gif圖片
還往大哥大姐們多多指教。

AspNet技術asp.net UpdaeProgress的簡單用法,轉載需保留來源!

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

主站蜘蛛池模板: 高雄市| 乃东县| 水富县| 韶关市| 鄂托克前旗| 上思县| 临清市| 福贡县| 宣武区| 育儿| 攀枝花市| 潞西市| 河东区| 黄梅县| 蒙自县| 安图县| 温州市| 固始县| 万宁市| 尉犁县| 保康县| 临邑县| 霍林郭勒市| 微山县| 利津县| 凌源市| 锡林浩特市| 岱山县| 大关县| 淳安县| 云安县| 嘉定区| 安康市| 嵊泗县| 南阳市| 六盘水市| 滦平县| 水富县| 马边| 永寿县| 永宁县|