Tuesday, May 14, 2013

How to use Ajax UpdateProgress Control in Asp.net


Introduction: In this post I will explain you we can use the Ajax Updateprogress control in Asp.net.
Description:
Open Visual Studio>File>New>Website. After that Add a new webform to website>Go to Toolbox>Ajax Extensions.
<asp:ScriptManager ID="ScriptManager1" runat="server">
        </asp:ScriptManager>
      
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
         <ContentTemplate>
         <asp:Button ID="btnupdate" runat="server" Text="Update" onclick="btnupdate_Click" />
         </ContentTemplate>
        </asp:UpdatePanel>
        <asp:UpdateProgress ID="UpdateProgress1" runat="server">
        <ProgressTemplate>
        <img src="Uploaded_Image/please-wait.gif" />
        </ProgressTemplate>
        </asp:UpdateProgress>
Now double click on button, which redirect you to .aspx.cs page. Add namsapce.
using System.Threading;

protected void btnupdate_Click(object sender, EventArgs e)
    {
        Thread.Sleep(3000);
    }
In VB

Imports System.Threading

Protected Sub btnupdate_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnupdate.Click
        Thread.Sleep(2000)
    End Sub
Run the project and check the result.


No comments:

Post a Comment