How to assign a value of base page element from child page's Page_Load? <p>I'm probably not the first who has this problem, but I can't find such question and solution for it. </p> <p>I have a base .aspx page and child page which inherits from the base page. From child's <code>Page_Load</code> method I call a method on a base page like <code>base.SetLiteral(value)</code> which acceses a literal defined in the base page. I get a NullReferenceException, as the literal is null.</p> <p>It probably has to do with page lifecycle as base page's controls are not instansiated at that point yet.</p> <p>How can I do it?</p> <p>EDIT</p> <p>Here is a stack trace of the exception. Doesn't say anything to me.</p> <pre><code>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: </code></pre>