asp.net updaeprogress Simple usage _ basic Application

Source: Internet
Author: User
UpdateProgress should be the meaning of "update progress".
How to use:
1. Add a ScriptManager control
2. Add a UpdatePanel Control
3. Add a UpdateProgress control
Set the associatedupdatepanelid of the UpdateProgress control to the ID of the 2nd step UpdatePanel (if there are multiple UpdatePanel on the page, Only the corresponding UpdatePanel associated updateprogress display)
Test example code:
Copy Code code as follows:

<%@ 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" >
<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>

<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= "Show data" ></asp:Label>
<asp:updateprogress id= "UpdateProgress1" runat= "Server" associatedupdatepanelid= "UpdatePanel1" >
<ProgressTemplate>
<div id= "Progress" >
Waiting for the ...
</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= "Show data" ></asp:Label>
<asp:updateprogress id= "UpdateProgress2" runat= "Server" associatedupdatepanelid= "UpdatePanel2" >
<ProgressTemplate>
Update data ....
</ProgressTemplate>
</asp:UpdateProgress>
</ContentTemplate>
</asp:UpdatePanel>
</form>
</body>


C # code:
Copy Code code as follows:

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 = "Refresh time:" + DateTime.Now.ToString ();
}
protected void Button2_click1 (object sender, EventArgs e)
{
System.Threading.Thread.Sleep (3000);
Label2.Text = "Refresh time:" + DateTime.Now.ToString ();
}
}

Among them, the CSS in the page code is an example on MSDN. UpdateProgress1 in UpdatePanel1 displays a animated GIF picture
Also to the Big Brother big sister advice.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.