Introduction:
Now in this article i will
explain with example How to show progress bar/ wait image using Update progress
control in as.net.
Description:
Description:
While fetching large amount of data from the data source, it will
take some time to show data. In that case we can show progress bar or waiting
image, which looks good.
Implementation: In the design page(.aspx) place ScriptManager control and a UpdateProgresscontrol that are under AJAX Extension category in the visual studio’s toolbox. Also place a Label and a Button Control as shown below. Search any gif image on the Google that you want to show when processing is going on. Let's take an example to understand.
Source Code:
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<fieldset style="width:200px">
<legend>Progress bar example</legend>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:Button ID="btnSubmit" runat="server" Text="Submit"
onclick="btnSubmit_Click" /><asp:Label ID="lblStatus"
runat="server" Text=""></asp:Label>
<asp:UpdateProgress ID="UpdWaitImage" runat="server" DynamicLayout="true"AssociatedUpdatePanelID="UpdatePanel1">
<ProgressTemplate>
<asp:Image ID="imgProgress" ImageUrl="Progress.gif" runat="server" />
Please Wait...
</ProgressTemplate>
</asp:UpdateProgress>
</ContentTemplate>
</asp:UpdatePanel>
</fieldset>
C#.NET Code to Show
progress bar using UpdateProgress control in asp.net
- In the code behind
file(.aspx.cs) write the on submit button's click event as:
protected void btnSubmit_Click(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(2000);
lblStatus.Text = "Processing
Completed";
}
VB.NET Code to Show progress bar
using UpdateProgress control in asp.net
- In the code behind
file(.aspx.vb) write the on submit button's click event as:
Protected Sub btnSubmit_Click(ByVal sender As Object, ByVal e As System.EventArgs) HandlesbtnSubmit.Click
System.Threading.Thread.Sleep(2000)
lblStatus.Text = "Processing
Completed"
End Sub
0 comments:
Post a Comment