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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T21:09:09+00:00 2026-05-26T21:09:09+00:00

I’m probably not the first who has this problem, but I can’t find such

  • 0

I’m probably not the first who has this problem, but I can’t find such question and solution for it.

I have a base .aspx page and child page which inherits from the base page.
From child’s Page_Load method I call a method on a base page like base.SetLiteral(value) which acceses a literal defined in the base page. I get a NullReferenceException, as the literal is null.

It probably has to do with page lifecycle as base page’s controls are not instansiated at that point yet.

How can I do it?

EDIT

Here is a stack trace of the exception. Doesn’t say anything to me.

System.NullReferenceException was unhandled by user code
Message=Object reference not set to an instance of an object.
Source=PageInheritance
StackTrace:
   at PageInheritance.BasePage.SetLiteral(String value) in D:\crap-projects\PageInheritance\BasePage.aspx.cs:line 17
   at PageInheritance.Page1.Page_Load(Object sender, EventArgs e) in D:\crap-projects\PageInheritance\Page1.aspx.cs:line 13
   at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)
   at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)
   at System.Web.UI.Control.OnLoad(EventArgs e)
   at System.Web.UI.Control.LoadRecursive()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
InnerException:  
  • 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-26T21:09:09+00:00Added an answer on May 26, 2026 at 9:09 pm

    Ok, it looks like when one inherits an .aspx page it’s only the code behind which is being inherited. The markup ( .aspx itself) is not inherited and there is no way (like ContentPlaceHolder in a Master page) to define what elements (from derived, base page or both) one wants to be on the result page.

    As base .aspx page is not inherited no controls added to it in designer ever initialized. I don’t really understand how it works though (Page_Init is called but how page decides not to initialize its controls is a mistery) Can anyone explain this bit?

    I will probably have to use Master page to achieve my goal, but I will continue my research and update my question.

    If I’m mistaken somewhere please let me know.

    EDIT

    Yes, I achieved what I needed to do using Master page instead of .aspx page inheritance. Did not have any problems there.

    P.S.

    I did find a way to inherit an .aspx page having markup in base page here: http://www.codeproject.com/KB/aspnet/page_templates.aspx but it looks like complete hackery to me.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I want to count how many characters a certain string has in PHP, but
I have a jquery bug and I've been looking for hours now, I can't
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
Seemingly simple, but I cannot find anything relevant on the web. What is the
Does anyone know how can I replace this 2 symbol below from the string

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.