Friday, 10 August 2012

Ajax UpdateProgress Example

You can use UpdateProgress control to show while application is processing user's request. You can get it From Toll box under Ajax Extensions Tab. I am describing you a scenario:

Suppose I have One Upadate Panel name UpdatePnl1 , In that I have a Button Say GO.when we hit on go it should redirect to another page. before that it will promt you "please wait".

Now my Code will be like that

<asp:UpdatePanel ID="UpdatePnl1" runat="server">
<ContentTemplate>
<asp:Button ID="BtnGO" runat="server" Text="GO" onclick="BtnGO_Click"/>
</ContentTemplate>
</asp:Updatepanel>
 
Button click event code:

 protected void BtnGO_Click(object sender, EventArgs e)
    {
        Response.Redirect("Example.aspx");
    }
 
Now here is the code for UpdateProgress what you need to add

<asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePnl1" >
      <ProgressTemplate>

      <asp:Label ID="LblWaitMsg" runat="server" Text="Processing Request, Please Wait...">
</asp:Label>           

       </ProgressTemplate>
 </asp:UpdateProgress>
 
Note: Your page Should contain ScriptManager.