UpdatePanelContentTemplateCS.aspx 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. // Access the Label1 control in the ContentTemplate.
  8. Label1.Text = "Panel refreshed at " + DateTime.Now.ToString();
  9. }
  10. </script>
  11. <html xmlns="http://www.w3.org/1999/xhtml">
  12. <head runat="server">
  13. <title>UpdatePanel Example</title>
  14. </head>
  15. <body>
  16. <form id="form1" runat="server">
  17. <div>
  18. <asp:ScriptManager ID="ScriptManager1"
  19. runat="server" />
  20. <asp:UpdatePanel ID="UpdatePanel1"
  21. UpdateMode="Conditional"
  22. runat="server">
  23. <ContentTemplate>
  24. <asp:Label ID="Label1"
  25. runat="server">A full page postback occurred.
  26. </asp:Label>
  27. <br />
  28. <asp:Button ID="Button1"
  29. Text="Refresh Panel"
  30. OnClick="Button1_Click"
  31. runat="server" />
  32. </ContentTemplate>
  33. </asp:UpdatePanel>
  34. <br />
  35. </div>
  36. </form>
  37. </body>
  38. </html>