default.aspx 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <%@ Page Language="C#" Culture="auto" %>
  2. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head id="Head1" runat="server">
  5. <title>Globalization Example</title>
  6. </head>
  7. <body>
  8. <form id="form1" runat="server">
  9. <asp:ScriptManager ID="ScriptManager1" EnableScriptGlobalization="true" runat="server">
  10. </asp:ScriptManager>
  11. <script type="text/javascript">
  12. function pageLoad() {
  13. Sys.UI.DomEvent.addHandler($get("Button1"), "click", formatDate);
  14. }
  15. function formatDate() {
  16. var d = new Date();
  17. try {
  18. $get('Label1').innerHTML = d.localeFormat("dddd, dd MMMM yyyy HH:mm:ss");
  19. }
  20. catch(e) {
  21. alert("Error:" + e.message);
  22. }
  23. }
  24. </script>
  25. <asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers="False" UpdateMode="Conditional">
  26. <ContentTemplate>
  27. <asp:Panel ID="Panel1" runat="server" GroupingText="Update Panel">
  28. <asp:Button ID="Button1" runat="server" Text="Display Date" />
  29. <br />
  30. <asp:Label ID="Label1" runat="server"></asp:Label>
  31. </asp:Panel>
  32. </ContentTemplate>
  33. </asp:UpdatePanel>
  34. </form>
  35. </body>
  36. </html>