Page Trace in code behind (C#)
<%@ Page language="c#" src="SimpleTrace.aspx.cs" AutoEventWireup="false" Inherits="SimpleTrace" %>
<HTML>
<body>
<FORM id="Form1" method="post" runat="server">
<asp:Label id="Label1" runat="server">A Simple Tracing Example</asp:Label><BR>
<BR>
<asp:Button id="cmdTrace" runat="server" Width="104px" Text="Trace"></asp:Button><BR>
<BR>
</FORM>
</body>
</HTML>
<%--
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
public class SimpleTrace : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.Button cmdTrace;
private void Page_Load(object sender, System.EventArgs e)
{
}
#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
InitializeComponent();
base.OnInit(e);
}
private void InitializeComponent()
{
this.cmdTrace.Click += new System.EventHandler(this.cmdTrace_Click);
this.Load += new System.EventHandler(this.Page_Load);
}
#endregion
private void cmdTrace_Click(object sender, System.EventArgs e)
{
Trace.IsEnabled=true;
}
}
--%>
Related examples in the same category