default.aspx 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. System.Threading.Thread.Sleep(3000);
  8. Label1.Text = DateTime.Now.ToString();
  9. }
  10. </script>
  11. <html xmlns="http://www.w3.org/1999/xhtml" >
  12. <head runat="server">
  13. <title>UpdateProgress Tutorial</title>
  14. <style type="text/css">
  15. #UpdatePanel1 {
  16. width:200px; height:100px;
  17. border: 1px solid gray;
  18. }
  19. #UpdateProgress1 {
  20. width:200px; background-color: #FFC080;
  21. bottom: 0%; left: 0px; position: absolute;
  22. }
  23. </style>
  24. </head>
  25. <body>
  26. <form id="form1" runat="server">
  27. <div>
  28. <asp:ScriptManager ID="ScriptManager1" runat="server"/>
  29. <script language="javascript" type="text/javascript">
  30. <!--
  31. var prm = Sys.WebForms.PageRequestManager.getInstance();
  32. function CancelAsyncPostBack() {
  33. if (prm.get_isInAsyncPostBack()) {
  34. prm.abortPostBack();
  35. }
  36. }
  37. // -->
  38. </script>
  39. <asp:UpdatePanel ID="UpdatePanel1" runat="server">
  40. <ContentTemplate>
  41. <asp:Label ID="Label1" runat="server" Text="Panel rendered."></asp:Label><br />
  42. <asp:Button ID="Button2" runat="server" OnClick="Button1_Click" Text="refresh" />
  43. </ContentTemplate>
  44. </asp:UpdatePanel>
  45. </div>
  46. <asp:UpdateProgress ID="UpdateProgress1" runat="server">
  47. <ProgressTemplate>
  48. Processing...
  49. <input id="Button2"
  50. type="button"
  51. value="cancel"
  52. onclick="CancelAsyncPostBack()" />
  53. </ProgressTemplate>
  54. </asp:UpdateProgress>
  55. </form>
  56. </body>
  57. </html>