home *** CD-ROM | disk | FTP | other *** search
ASP.NET Web Form | 2000-04-28 | 2.2 KB | 74 lines |
- <%@ Page Trace=True %>
- <%@ Register TagPrefix="Code" Namespace="Microsoft.Samples.Utils.CodeShow" %>
-
- <html>
-
- <script language="COOL" runat=server>
-
- public void Page_Load(Object sender, EventArgs e) {
- Page.Trace.Write("Test", "Got here!");
- }
-
- private void Btn1_Click(Object sender, EventArgs e) {
-
- Page.Trace.Write("Test", "Button Clicked!");
-
- if (Request.Cookies["Microsoft.Samples.Utils.CodeShow.CodePreference"] == null) {
- Page.Trace.Write("Test", "Button Clicked - its null!");
- Response.AppendCookie (new HttpCookie("Microsoft.Samples.Utils.CodeShow.CodePreference", "VB"));
- }
- else if (Request.Cookies["Microsoft.Samples.Utils.CodeShow.CodePreference"].Value == "VB") {
- Page.Trace.Write("Test", "Button Clicked - its VB!");
- Response.Cookies["Microsoft.Samples.Utils.CodeShow.CodePreference"].Value = "C#";
- }
- else if (Request.Cookies["Microsoft.Samples.Utils.CodeShow.CodePreference"].Value == "C#") {
- Page.Trace.Write("Test", "Button Clicked - its C#!");
- Response.Cookies["Microsoft.Samples.Utils.CodeShow.CodePreference"].Value = "Foo";
- }
- else {
- Page.Trace.Write("Test", "Button Clicked - its Foo!");
- Response.Cookies["Microsoft.Samples.Utils.CodeShow.CodePreference"].Value = "VB";
- }
-
- Page.Trace.Write("Test", "Button Clicked - " + Request.Cookies["Microsoft.Samples.Utils.CodeShow.CodePreference"].Value);
-
-
- }
-
- </script>
-
-
- <body>
-
- <p>Test
-
-
- <form method="POST" action="Test.aspx" runat=server>
-
- <Code:CodeSnippet id="CS1" runat=server>
-
-
- <template name="VBTemplate">
- <xmp>
- Some VB code
- </xmp>
- </template>
-
- <template name="CsTemplate">
- <xmp>
- Some C# code
- </xmp>
- </template>
-
- </Code:CodeSnippet>
-
- <asp:Button Text="Set Code type" runat=server onclick="Btn1_Click">
- </asp:Button>
-
-
- </form>
-
- </body>
-
- </html>
-