Introduction: UpdateProgress control in asp.net

In this post, we will learn about how to use UpdateProgress control in asp.net in C# with example


Description:

In my previous posts I have explained various topics like Ajax Control in ASP.NET, AJAX Basics, Optional Arguments In C#, difference between Stack and Heap memory in C#, Difference Between Class And Structure, ASP.NET Core, C# static constructor, Nullables in C#, Collections in C#SortedSet in C#.Net, Stack in C#, Queue in C#.Net, LinkedList in C#.Net.

Now in this post, I will explain about how to use UpdateProgress control in asp.net with C# example. This will use your own custome template(Any text or image) to show that an asynchronus method is working. While working with AJAX ,it will make asynchronus  call to server at that time browser will not show any status, so user may get impatient. In this type of scenario you can use UpdateProgress control to show some text or image which inform user that some internal process is going on.

UpdateProgress control in asp.net

UpdateProgress control in asp.net

Now open Visual Studio and create Web form application and write below lines of code in it.

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UpdateProgress.aspx.cs" Inherits="WebFormDemo.UpdateProgress" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>UpdateProgress control</title>
</head>
<body>
    <form id="frmMain" runat="server">
    <div>
     <asp:ScriptManager ID="smMain" runat="server" />
        <asp:UpdateProgress runat="server" id="PageUpdateProgress">
            <ProgressTemplate>
                Please wait...
            </ProgressTemplate>
        </asp:UpdateProgress>
        <asp:UpdatePanel runat="server" id="Panel">
            <ContentTemplate>
                <asp:Button runat="server" id="UpdateButton" onclick="UpdateButton_Click" text="Update" />
            </ContentTemplate>
        </asp:UpdatePanel>
    </div>
    </form>
</body>
</html>

In the code behind file write below lines of code.

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

This simple example will just show you how easy it is to use the UpdateProgress control in asp.net.
I hope you got an idea about UpdateProgress control in asp.net.
I would like to have feedback from my blog readers.
Your valuable feedback, question, or comments about this article are always welcome.

Leave a Reply

Your email address will not be published. Required fields are marked *

Name *
Email *
Website