Tuesday, 3 December 2013

ASP.NET Ajax UpdateProgress

UpdateProgress control shows the status information for the progress of the download occurring during the partial-page rendering in the UpdatePanel. The page can contain multiple UpdateProgress controls. Each one can be associated with a different UpdatePanel control. Alternatively, you can use one UpdateProgress control and associate it with all the UpdatePanel controls on the page. You can place UpdateProgress control either inside or outside the UpdatePanel controls. The following Asp.Net program shows how to an UpdateProgress control waits for completion of the task and during this waiting time it shows a .gif file as waiting message. Default.aspx

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Untitled Page</title>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
<asp:UpdateProgress ID="UpdateProgress1" runat="server">
<img alt="ajax-progress" src="http://asp.net-informations.com/ajax/img/ajax-progress.gif"></img>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<asp:Label ID="Label1" runat="server" Text=""></asp:Label>
<br />
<asp:Button ID="Button1" runat="server" Text="Button" onclick="Button1_Click" />


using System;
using System.Web.UI;

public partial class _Default : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)

protected void Button1_Click(object sender, EventArgs e)
Label1.Text = "Server Time :  " + DateTime.Now.ToString();


Partial Class _Default
Inherits System.Web.UI.Page

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Label1.Text = "Server Time :  " & DateTime.Now.ToString()
End Sub
End Class

ASP.NET Ajax UpdateProgress