Skip to main content

Show loading image during button click..


Using ASP.NET AJAX UpdateProgress Control

Hi,

You can use the Ajax Updatepanel with Ajax update Progress to solve this problem.

Step1:
Put your button in an update panel

Step2:
Drop an UpdateProgress to your webform and associate this with your updatepanel

<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Button ID="Button1" runat="server" Text="Button" />
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdateProgress ID="UpdateProgress1" runat="server"
AssociatedUpdatePanelID="UpdatePanel1">
</asp:UpdateProgress>

Step3:
Create a template for your "Loading" text to be shown when you click the button and put that inside the updateprogress's <ProgressTemplate> tag

<ProgressTemplate>
<div>loading</div>
</ProgressTemplate>

you can add the some style like position absolute, etc to the template inorder to see this is in stylish, I leave that up to you

Step4:
Finish

Comments