home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 40 / IOPROG_40.ISO / SOFT / NETFrameworkSDK.exe / comsdk.cab / samples.exe / QuickStart / util / ShowCode / Test.aspx < prev   
Encoding:
ASP.NET Web Form  |  2000-04-28  |  2.2 KB  |  74 lines

  1. <%@ Page Trace=True %>
  2. <%@ Register TagPrefix="Code" Namespace="Microsoft.Samples.Utils.CodeShow" %>
  3.  
  4. <html>
  5.  
  6.    <script language="COOL" runat=server>
  7.  
  8.       public void Page_Load(Object sender, EventArgs e) {
  9.         Page.Trace.Write("Test", "Got here!");
  10.       }
  11.  
  12.       private void Btn1_Click(Object sender, EventArgs e) {
  13.  
  14.         Page.Trace.Write("Test", "Button Clicked!");
  15.         
  16.         if (Request.Cookies["Microsoft.Samples.Utils.CodeShow.CodePreference"] == null)  {
  17.             Page.Trace.Write("Test", "Button Clicked - its null!");
  18.             Response.AppendCookie (new HttpCookie("Microsoft.Samples.Utils.CodeShow.CodePreference", "VB"));
  19.         }
  20.         else if (Request.Cookies["Microsoft.Samples.Utils.CodeShow.CodePreference"].Value == "VB") {
  21.             Page.Trace.Write("Test", "Button Clicked - its VB!");
  22.             Response.Cookies["Microsoft.Samples.Utils.CodeShow.CodePreference"].Value = "C#";
  23.         }
  24.         else if (Request.Cookies["Microsoft.Samples.Utils.CodeShow.CodePreference"].Value == "C#") {
  25.             Page.Trace.Write("Test", "Button Clicked - its C#!");
  26.             Response.Cookies["Microsoft.Samples.Utils.CodeShow.CodePreference"].Value = "Foo";
  27.         }
  28.         else {
  29.             Page.Trace.Write("Test", "Button Clicked - its Foo!");
  30.             Response.Cookies["Microsoft.Samples.Utils.CodeShow.CodePreference"].Value = "VB";
  31.         }    
  32.     
  33.         Page.Trace.Write("Test", "Button Clicked - " + Request.Cookies["Microsoft.Samples.Utils.CodeShow.CodePreference"].Value);
  34.  
  35.  
  36.       }
  37.       
  38.    </script>
  39.  
  40.  
  41.    <body>
  42.    
  43.     <p>Test
  44.  
  45.  
  46.       <form method="POST" action="Test.aspx" runat=server>
  47.  
  48.          <Code:CodeSnippet id="CS1" runat=server>
  49.          
  50.              
  51.               <template name="VBTemplate">
  52.                 <xmp>
  53.                     Some VB code
  54.                 </xmp>
  55.               </template>
  56.  
  57.               <template name="CsTemplate">
  58.                 <xmp>
  59.                     Some C# code
  60.                 </xmp>
  61.               </template>
  62.  
  63.           </Code:CodeSnippet>
  64.  
  65.             <asp:Button Text="Set Code type" runat=server onclick="Btn1_Click">
  66.             </asp:Button>
  67.  
  68.  
  69.       </form>
  70.  
  71.    </body>
  72.  
  73. </html>
  74.