当前位置:编程学习 > asp >>

ASP.NET之用AJAX设置进度条

源码:
.aspx
 
 1 <body>
 2     <form id="form1" runat="server">
 3     <div>
 4         <asp:ScriptManager ID="ScriptManager1" runat="server">
 5         </asp:ScriptManager>
 6         <asp:UpdatePanel ID="UpdatePanel1" runat="server">
 7         <ContentTemplate>
 8             <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
 9             <asp:Button ID="Button1" runat="server" Text="文件上传" onclick="Button1_Click" />
10         </ContentTemplate>
11         </asp:UpdatePanel>
12         <asp:UpdateProgress ID="UpdateProgress1" runat="server"  AssociatedUpdatePanelID="UpdatePanel1">
13         <ProgressTemplate>文件上传中...<img src="images/wait.gif" / alt="上传中..."> </ProgressTemplate>
14         </asp:UpdateProgress>
15     </div>
16     </form>
17 </body>
 
 
 
.cs
 
 1 public partial class _Default : System.Web.UI.Page
 2 {
 3     protected void Page_Load(object sender, EventArgs e)
 4     {
 5
 6     }
 7     protected void Button1_Click(object sender, EventArgs e)
 8     {
 9         System.Threading.Thread.Sleep(5000);
10         this.Label1.Text = "上传完成";
11       
12     }
13 }
 

 

 
摘自 jory

补充:Web开发 , ASP.Net ,
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,