Tuesday, 29 July 2014

How to use ProgressTemplate in ASP.NET Ajax UpdateProgress

Ajax ProgressTemplate – How to use Progress Template in asp.net Ajax Update Progress

  1. <%@ Page Language=“C#” %>
  2. <%@ Import Namespace=“System.Drawing” %>

  3. <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
  4. <script runat=“server”>
  5.     protected void Page_Load(object sender, EventArgs e)
  6.     {
  7.         if (!Page.IsPostBack)
  8.         {
  9.             BulletedList1.Width = 500;
  10.             BulletedList1.BackColor = Color.AliceBlue;
  11.             BulletedList1.Font.Bold = true;
  12.             BulletedList1.Font.Size = FontUnit.Medium;
  13.         }
  14.     }
  15.     protected void Button1_Click(object sender, EventArgs e)
  16.     {
  17.         System.Threading.Thread.Sleep(5000);
  18.         BulletedList1.Items.Add(DateTime.Now.ToLongTimeString());
  19.     }
  20. </script>
  21. <html xmlns=“http://www.w3.org/1999/xhtml” >
  22. <head id=“Head1″ runat=“server”>
  23.     <title>Ajax ProgressTemplate - How to use ProgressTemplate in asp.net ajax UpdateProgress</title>
  24. </head>
  25. <body>
  26.     <form id=“form1″ runat=“server”>
  27.     <div>
  28.         <h2 style=“color:DarkBlue; font-style:italic;”>Ajax UpdateProgress Example: Using ProgressTemplate</h2>
  29.         <hr width=“550″ align=“left” color=“LightBlue” />
  30.         <asp:ScriptManager
  31.             ID=“ScriptManager1″
  32.             runat=“server”
  33.             >
  34.         </asp:ScriptManager>
  35.         <asp:UpdateProgress ID=“UpdateProgress1″ runat=“server”>
  36.             <ProgressTemplate>
  37.                 <asp:Label
  38.                     ID=“Label1″
  39.                     runat=“server”
  40.                     ForeColor=“OrangeRed”
  41.                     Font-Bold=“true”
  42.                     Font-Italic=“true”
  43.                     Font-Names=“Comic Sans MS”
  44.                     Font-Size=“Large”
  45.                     Text=“Please wait page updating…..”
  46.                     >
  47.                 </asp:Label>
  48.             </ProgressTemplate>
  49.         </asp:UpdateProgress>
  50.         <br />
  51.         <asp:UpdatePanel ID=“UpdatePanel1″ runat=“server”>
  52.             <ContentTemplate>
  53.                 <asp:BulletedList
  54.                     ID=“BulletedList1″
  55.                     runat=“server”
  56.                     ForeColor=“DarkSeaGreen”
  57.                     BulletStyle=“LowerAlpha”
  58.                     BorderColor=“LawnGreen”
  59.                     BorderWidth=“1″
  60.                     >
  61.                 </asp:BulletedList>
  62.                 <br /><br />
  63.                 <asp:Button
  64.                     ID=“Button1″
  65.                     runat=“server”
  66.                     OnClick=“Button1_Click”
  67.                     Font-Bold=“true”
  68.                     Height=“45″
  69.                     Text=“Get Button Click System Time”
  70.                     ForeColor=“DodgerBlue”
  71.                     />
  72.             </ContentTemplate>
  73.         </asp:UpdatePanel>
  74.     </div>
  75.     </form>
  76. </body>
  77. </html>




No comments:

Post a Comment