ASP.eventtracker_aspx' does not contain a definition
<p>I am going through a ASP C# book and doing the tutorials. However I have encountered a problem. I have the following code that will list some events. </p>

<p>EventTracker.aspx </p>

<pre><code>&lt;%@ Page Language="C#" AutoEventWireup="true" CodeFile="EventTracker.aspx.cs" Inherits="EventTracker" %&gt;

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"&gt;

&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head id="Head1" runat="server"&gt;
  &lt;title&gt;Event Tracker&lt;/title&gt;
  &lt;style type="text/css"&gt;
      h1 
      {
          font-size: large;       
      }
  &lt;/style&gt;
&lt;/head&gt;
&lt;body&gt;
  &lt;form id="Form1" runat="server"&gt;
    &lt;div&gt;       
      &lt;h1&gt;Controls being monitored for change events:&lt;/h1&gt;
      &lt;asp:TextBox ID="txt" runat="server" AutoPostBack="true"
       OnTextChanged="CtrlChanged" /&gt;
      &lt;br /&gt;&lt;br /&gt;
      &lt;asp:CheckBox ID="chk" runat="server" AutoPostBack="true"
       OnCheckedChanged="CtrlChanged"/&gt;
      &lt;br /&gt;&lt;br /&gt;
      &lt;asp:RadioButton ID="opt1" runat="server" GroupName="Sample"
       AutoPostBack="true" OnCheckedChanged="CtrlChanged"/&gt;
      &lt;asp:RadioButton ID="opt2" runat="server" GroupName="Sample"
       AutoPostBack="true" OnCheckedChanged="CtrlChanged"/&gt;
      &lt;br /&gt;&lt;br /&gt;&lt;br /&gt; 
       &lt;h1&gt;List of events:&lt;/h1&gt;
      &lt;asp:ListBox ID="lstEvents" runat="server" Width="355px"
       Height="305px" /&gt;&lt;br /&gt;      
    &lt;/div&gt;
  &lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>EventTracker.aspx.cs</p>

<pre><code>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 partial class EventTracker : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Log("&lt;&lt; Page_Load&gt;&gt;");

    }

    protected void Page_PreRender(object sender, EventArgs e)
    {
        //Find the control ID of the sender. 
        //This requires converting the Object type into a control class. 
        string ctrlName = ((Control)sender).ID;
        Log(ctrlName + " Changed");
    }

    protected void Log(string entry)
    {
        lstEvents.Items.Add(entry);

        //Select the last item to scroll the list so the most recent are visible
        lstEvents.SelectedIndex = lstEvents.Items.Count - 1;
    }
}
</code></pre>

<p>I am recieving the following error: </p>

<blockquote>
  <p>Error 1   'ASP.eventtracker_aspx' does not contain a definition for
  'CtrlChanged' and no extension method 'CtrlChanged' accepting a first
  argument of type 'ASP.eventtracker_aspx' could be found (are you
  missing a using directive or an assembly reference?)</p>
</blockquote>

<p>I am new to ASP and would like to understand why such an error is occurring so in future reference I know what is causing it. </p>
