Interested in Sitecore?

Apply for our Mentorship Program by emailing your resume to chris.williams@techguilds.com. Check out our ASP.NET QuickStart and C# QuckStart Libraries. Below is my latest articles.

Tuesday, June 30, 2009

Theme not being applied for a certain page

Scenario: You put the default theme in the web.config. You check the theme value all the way through the event chain and its value is correct but the css references never make it to your page.

Solution: You probably overrode the Page.OnInit event and did not call the base.
NOTE: If your page derives from a base page be sure to check if it is overriding properly by calling base.OnInit(e)

The Page.OnInit method does the following
protected internal override void OnInit(EventArgs e)
{
base.OnInit(e);
if (this._theme != null)
{
this._theme.SetStyleSheet();
}
if (this._styleSheet != null)
{
this._styleSheet.SetStyleSheet();
}
}
Obviously by not calling the base.OnInit method on my derived Page class would ignore the inclusion of theme files.

The original answer was found here: http://forums.asp.net/t/1028417.aspx

If you have any tips, tricks or resources you would like to share with the group please email them to chrisw_88@hotmail.com or susan@clinchportal.com and we will add them here.