Aspx Code : < ASP: scriptmanager ID = " Scriptmanager1 " Runat = " Server " >
</ ASP: scriptmanager >
< ASP: updatepanel ID = " Updatepanel1 " Runat = " Server " >
< Contenttemplate >
< ASP: Label ID = " Label1 " Runat = " Server " Text = " Page Initialization " > </ ASP: Label >
< ASP: button ID = " Button1 " Runat = " Server " Onclick = " Button#click " Text = " Button " />
< ASP: updateprogress ID = " Updateprogress1 " Runat = " Server " Associatedupdatepanelid = " Updatepanel1 " >
< Progresstemplate >
Panel1 is processing data
</ Progresstemplate >
</ ASP: updateprogress >
</ Contenttemplate >
</ ASP: updatepanel >
< BR />
< BR />
< ASP: updatepanel ID = " Updatepanel2 " Runat = " Server " >
< Contenttemplate >
< ASP: Label ID = " Label2 " Runat = " Server " Text = " Page Initialization " > </ ASP: Label >
< ASP: button ID = " Button2 " Runat = " Server " Onclick = " Button2_click " Text = " Button " />
< ASP: updateprogress ID = " Updateprogress2 " Runat = " Server " Associatedupdatepanelid = " Updatepanel2 " >
< Progresstemplate >
Panel2 is processing data
</ Progresstemplate >
</ ASP: updateprogress >
</ Contenttemplate >
</ ASP: updatepanel >
Aspx. CS code:
Protected Void Button#click ( Object Sender, eventargs E)
{
System. Threading. thread. Sleep ( 3000 ); // Added a 3-second delay, in order to make updateprogress Display Effect
Label1.text = " Page refreshed " +
Datetime. Now. tostring ();
}
Protected VoidButton2_click (ObjectSender, eventargs E)
{
System. Threading. thread. Sleep (3000);
Label2.text= "Page refreshed" +
Datetime. Now. tostring ();
}
Key points:
<Asp: updateprogress id = "updateprogress2" runat = "server" associatedupdatepanelid = "updatepanel2">
To specify the associatedupdatepanelid attribute for the updateprogress control, you need to specify the updatepanel. This way
Updateprogress can be selected to take effect for a certain updatepanel!