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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T20:43:19+00:00 2026-05-26T20:43:19+00:00

In an asp.net webforms app I have created a base class for my pages

  • 0

In an asp.net webforms app I have created a base class for my pages to derive from. I have declared the page load method in the base class as so:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Response.Write("base")
End Sub

Now, in a class that inherits this class, I have used the page load method again:

Protected Shadows Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Response.Write("descendant")
End Sub

For a reason I do not understand, I am seeing both parent and child get written to the page. Both Page_Load methods are being executed. Why is this? I was under the impression that shadowing or overloading a base class method in a descendant class would essentially hide the base class method. I have searched the internet but I cannot find a concrete explanation as to why this is happening.

Thanks,
JS

  • 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-26T20:43:20+00:00Added an answer on May 26, 2026 at 8:43 pm

    The Page_Loadmethod is bound to the Page.Load event. If you add a Page_Load method to your subclass, the framework automatically adds this one as a handler in addition to the one of the base class. The code resulting from the precompiler could look somewhat like this, and therefore both methods are being executed once the Load event fires:

    // VB.net (no idea if this really compiles, I'm more into C#)
    AddHandler Load, AddressOf BaseClass.PageLoad
    AddHandler Load, AddressOf SubClass.PageLoad
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm converting an app from ASP.NET WebForms to WinForms. There is one asp.net page
We have an ASP.NET 2.0 WebForms app that uses MS Ajax 1.0. It's working
I have a simple web app built in asp.net webforms c# where and how
If I start running my asp.net WebForms app from the VS2008 IDE in debug
I'm working on creating a new base class for an asp.net app in order
I have a reporting module in an ASP.NET webforms app (C#) that uses dynamic
Previous working asp.net webforms app now throws this error: System.MissingMethodException: Method not found The
I have an asp .net webforms app that uses forms authentication. For a small
I have created an ASP.NET Webforms web application which basically inetracts with the code
We have an ASP.NET webforms app that has try/catch blocks all throughout. In the

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.