欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

ASP.NET之用AJAX设置进度条

程序员文章站 2023-11-01 17:12:10
源码: .aspx    1  2    

源码
.aspx
 
 1 <body>
 2     <form id="form1" runat="server">
 3     <p>
 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     </p>
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