UpdatePanelHowToWithUpdatePanel.aspx 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 Page_Load(object sender, EventArgs e)
  6. {
  7. if (!IsPostBack)
  8. Label1.Text = "Initial panel contents rendered at " +
  9. DateTime.Now.ToString();
  10. else
  11. Label1.Text = "Pane contents refreshed at " +
  12. DateTime.Now.ToString();
  13. }
  14. </script>
  15. <html xmlns="http://www.w3.org/1999/xhtml" >
  16. <head id="Head1" runat="server">
  17. <title>UpdatePanel Example</title>
  18. </head>
  19. <body>
  20. <form id="form1" runat="server">
  21. <div>
  22. <asp:ScriptManager ID="SriptManager1"
  23. runat="server" />
  24. <fieldset>
  25. <asp:UpdatePanel ID="UpdatePanel1"
  26. runat="server">
  27. <ContentTemplate>
  28. <asp:Label ID="Label1"
  29. runat="server"/>
  30. <br />
  31. <asp:Button ID="Button1"
  32. Text="Refresh UpdatePanel"
  33. runat="server" />
  34. </ContentTemplate>
  35. </asp:UpdatePanel>
  36. </fieldset>
  37. <asp:Button ID="Button2"
  38. Text="Refresh Page"
  39. runat="server" />
  40. </div>
  41. </form>
  42. </body>
  43. </html>