How to set updateprogress when clicking on button inside the update panel?

Posted by Suraj1.Niit under ASP.NET AJAX on 1/24/2014 | Points: 10 | Views : 1287 | Status : [Member] | Replies : 1
I've two updatepanel on my page and I'm trying to use updateprogress with first update panel not with the second updatepanel. But it'll work with both updatepanels. How can I restrict the working of updateprogress on both updatepanels.




Responses

Posted by: A2H on: 3/5/2014 [Member] [MVP] Silver | Points: 25

Up
0
Down
Hi,
You can set the 'AssociatedUpdatePanelID' property of UpdateProgress as your FirstUpdatePanel. THis will ensure that the update progress is displayed only for FirstUpdatePanel.

HTML:
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true">
</asp:ScriptManager>
<asp:UpdatePanel runat="server" ID="UpdatePanel1">
<ContentTemplate>
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdateProgress runat="server" ID="PageUpdateProgress" AssociatedUpdatePanelID="Panel" >
<ProgressTemplate>
Please wait til the operation completes
<%--You can add your loading image here--%>
<img alt="progress" src="images/loading.gif" />
</ProgressTemplate>
</asp:UpdateProgress>
<asp:UpdatePanel runat="server" ID="Panel">
<ContentTemplate>
<asp:Button runat="server" ID="UpdateButton" OnClick="UpdateButton_Click" Text="Update" />
</ContentTemplate>
</asp:UpdatePanel>


C#:
protected void Button1_Click(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(5000);
}


protected void UpdateButton_Click(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(5000);
}


Thanks,
A2H
My Blog

Suraj1.Niit, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response