tags:

views:

211

answers:

2

We have an ASP.net 2.0 web application which is using themes set on the application level using web.config. The theme gets applied correctly for any web page that inherits from Page. The problem is that theme doesn't get applied to our base page which is also inherits from Page.

Suppose our base page is called MyBasePage : Page.

page1.aspx which inheretis from Page: Theme Applied.

page2.aspx which inheretis from MyBasePage: Theme not Applied.

What makes it even more confusing is that when we try and debug page2.aspx at Page_Load to check the value of this.Theme it is actually set to our theme but without the styles being applied.

Any suggestions on how to fix this?

A: 

You might find your answer here in a very similar question.

DOK
not the case with our pages since they are authenticated and all pages which inherit from the .net base class Page show the theme correctly.
Mohamed Osman
+1  A: 

Make sure you are using the base keyword to call the appropriate overridden base class members from within your derived class.

public class MyBasePage : System.Web.UI.Page
{
    protected override void OnInit(EventArgs e)
    {
        // Call the base class's OnInit method
        base.OnInit(e);
    }

    protected override void OnLoad(EventArgs e)
    {
       // Call the base class's OnLoad method
       base.OnLoad(e);
    }       
}
Phaedrus
thanks that did solve the problem
Mohamed Osman