Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6952715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:23:05+00:00 2026-05-27T14:23:05+00:00

I am going through a ASP C# book and doing the tutorials. However I

  • 0

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.

EventTracker.aspx

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="EventTracker.aspx.cs" Inherits="EventTracker" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

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

EventTracker.aspx.cs

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("<< Page_Load>>");

    }

    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;
    }
}

I am recieving the following error:

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?)

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T14:23:06+00:00Added an answer on May 27, 2026 at 2:23 pm

    In your markup you have

    OnCheckedChanged="CtrlChanged"
    

    But there is no event handler with that name / matching signature in your codebehind…

    This event will be triggered everytime your CheckBox changes, but you do not have anything in the code that will respond.

    You need something like

    protected void CtrlChanged(object sender, EventArgs e)   
        {  // do something }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm going through some old C#.NET code in an ASP.NET application making sure that
I'm going through some old C#.NET code in an ASP.NET application making sure that
I was going through someone's .asp code and saw that he was printing a
I have an asp.net web app that's going through a pen test by internal
We're going through an ASP.Net MVC book and are having trouble with using an
Just going through the sample Scala code on Scala website, but encountered an annoying
I am starting asp.net MVC2 by going through a few tutorials, but they are
I am going through a weird problem right now regarding routing in ASP.NET WebForms.
I have been reviewing model binding with collections, specifically going through this article http://weblogs.asp.net/nmarun/archive/2010/03/13/asp-net-mvc-2-model-binding-for-a-collection.aspx
I'm currently going through the ASP.NET MVC NerdDinner tutorial and am having a problem

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.