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 8096277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:24:10+00:00 2026-06-05T21:24:10+00:00

I was trying to add some non-production test code by creating a 3rd partial

  • 0

I was trying to add some non-production test code by creating a 3rd partial file in addition to MyPage.aspx and MyPage.aspx.cs and MyPage.aspx.designer.cs. I called my third file MyPage.aspx.TEST.cs

In the partial file MyPage.aspx.TEST.cs, I wrote the following:

protected override void OnInit(EventArgs e)
{
    Page.LoadComplete += RunTest;
    base.OnInit(e);
}
//Assert.

public void RunTest(object sender, EventArgs e)
{
    //Clever assertions
}

The code compiles and I then decompile the code and there it is, I can see the OnInit override and the RunTest method.

But when I execute the page, the event doesn’t register, nor run, nor can I set a breakpoint.

I move that code out of the MyPage.aspx.TEST.cs partial class into the MyPage.aspx.cs partial file and the event registers and is executed. Stranger, when I decompile the assembly, and do a diff, the class appears to decompile to the same code.

Possible clues that may be unrelated:

  • The page uses autoeventwireup=”true” (I still get the same behavior if I try to register my event my Page_LoadComplete)
  • The application is a web application (i.e.uses a proj file)
  • The partial file does compile (and if I introduce errors into the partial file, it will prevent compilation, so I know for sure that the partial file does get compiled)
  • I get the same result using different events (PreRender, etc)
  • 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-06-05T21:24:11+00:00Added an answer on June 5, 2026 at 9:24 pm

    This is strange, I just made the same experiment and all the events are being fired, I have the same conditions, web application, autoeventwireup = true

    Are you inheriting from another base page?

    This is my partial class:

    public partial class _Default
    {
        protected override void OnInit(EventArgs e)
        {
            this.LoadComplete += RunTest;
            this.Load += new EventHandler(_Default_Load);
            base.OnInit(e);
        }
    
        void _Default_Load(object sender, EventArgs e)
        {
            //throw new NotImplementedException();
        }
    
        void RunTest(object sender, EventArgs e)
        {
            //throw new NotImplementedException();
        }
    
        protected override void OnPreRender(EventArgs e)
        {
            this.Response.Write("omfgggg");
            this.lblMyMessageTest.Text = "omfg2";
            base.OnPreRender(e);
        }
    }
    

    All the events works, if I uncomment the //throw new NotImplementedException(); I get the exception as expected.

    Try the following:

    • Ensure the name of your partial page classes are the same
    • Try to change Page.LoadComplete += RunTest; to this.LoadComplete += RunTest;
    • Ensure you are not terminating the response of the page when an exception occurs
    • If you have a custom HTTP module, try to disable it, it might be interfering with the events somehow
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im trying to add some short file names to a Wise installer to fix
I am trying to add some code to my Spring JSP to display a
Trying to add some extra elements to my session variables for filesystem directory work,
I am trying to add some fields to the user after the user has
I'm trying to add some text to a listBox in a form, from another
I'm trying to add some behavior for the right click event. Weirdly I simply
When I was trying to add some input fields with css I got a
I'm trying to add some shadows to one of my views and what I
I am trying to add some external javascript files to the magento cms but
I'm trying to add some accessibility for screen readers into a Flash application, and

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.