default.aspx 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. <%@ Page Language="C#" %>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  3. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4. <script runat="server">
  5. protected void Button1_Click(object sender, EventArgs e)
  6. {
  7. // Introducing delay for demonstration.
  8. System.Threading.Thread.Sleep(3000);
  9. Label1.Text = "Page refreshed at " +
  10. DateTime.Now.ToString();
  11. }
  12. protected void Button2_Click(object sender, EventArgs e)
  13. {
  14. // Introducing delay for demonstration.
  15. System.Threading.Thread.Sleep(3000);
  16. Label2.Text = "Page refreshed at " +
  17. DateTime.Now.ToString();
  18. }
  19. </script>
  20. <html xmlns="http://www.w3.org/1999/xhtml" >
  21. <head id="Head1" runat="server">
  22. <title>UpdateProgress Tutorial</title>
  23. <style type="text/css">
  24. #UpdatePanel1, #UpdatePanel2 {
  25. width:300px; height:100px;
  26. }
  27. </style>
  28. </head>
  29. <body>
  30. <form id="form1" runat="server">
  31. <div>
  32. <asp:ScriptManager ID="ScriptManager1" runat="server">
  33. </asp:ScriptManager>
  34. <asp:UpdatePanel ID="UpdatePanel1" runat="server">
  35. <ContentTemplate>
  36. <fieldset>
  37. <legend>UpdatePanel1</legend>
  38. <asp:Label ID="Label1" runat="server" Text="Panel initially rendered."></asp:Label>
  39. <br />
  40. <asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
  41. <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1">
  42. <ProgressTemplate>
  43. Panel1 updating...
  44. </ProgressTemplate>
  45. </asp:UpdateProgress>
  46. </fieldset>
  47. </ContentTemplate>
  48. </asp:UpdatePanel>
  49. <asp:UpdatePanel ID="UpdatePanel2" runat="server">
  50. <ContentTemplate>
  51. <fieldset>
  52. <legend>UpdatePanel2</legend>
  53. <asp:Label ID="Label2" runat="server" Text="Panel initially rendered."></asp:Label>
  54. <br />
  55. <asp:Button ID="Button2" runat="server" Text="Button" OnClick="Button2_Click" />
  56. <asp:UpdateProgress ID="UpdateProgress2" runat="server" AssociatedUpdatePanelID="UpdatePanel2">
  57. <ProgressTemplate>
  58. Panel2 updating....
  59. </ProgressTemplate>
  60. </asp:UpdateProgress>
  61. </fieldset>
  62. </ContentTemplate>
  63. </asp:UpdatePanel>
  64. </div>
  65. </form>
  66. </body>
  67. </html>