How to Execute Page_Load() in Page's Base Class?

Posted by DaveDev on Stack Overflow See other posts from Stack Overflow or by DaveDev
Published on 2010-04-29T12:04:54Z Indexed on 2010/04/29 12:07 UTC
Read the original article Hit count: 219

Filed under:
|
|

I have the following PerformanceFactsheet.aspx.cs page class

public partial class PerformanceFactsheet : FactsheetBase
{
    protected void Page_Load(object sender, EventArgs e)
    {
        // do stuff with the data extracted in FactsheetBase
        divPerformance.Controls.Add(this.Data);
    }
}

where FactsheetBase is defined as

public class FactsheetBase : System.Web.UI.Page
{
    public MyPageData Data { get; set; } 
    protected void Page_Load(object sender, EventArgs e)
    {
        // get data that's common to all implementors of FactsheetBase
        // and store the values in FactsheetBase's properties
        this.Data = ExtractPageData(Request.QueryString["data"]);            
    }
}

The problem is that FactsheetBase's Page_Load is not executing.

Can anyone tell me what I'm doing wrong? Is there a better way to get the result I'm after?

Thanks

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about page-lifecycle