This topic has not yet been rated - Rate this topic

Page.StyleSheetTheme Property

Gets or sets the name of the theme that is applied to the page early in the page life cycle.

Namespace:  System.Web.UI
Assembly:  System.Web (in System.Web.dll)
[BrowsableAttribute(false)]
public virtual string StyleSheetTheme { get; set; }
<asp:Page StyleSheetTheme="String" />

Property Value

Type: System.String
The name of the theme that is applied to the page early in the page life cycle.
Exception Condition
InvalidOperationException

An attempt was made to set the StyleSheetTheme property after the FrameworkInitialize method was called.

ArgumentException

StyleSheetTheme is set to an invalid theme name. This exception is thrown when the FrameworkInitialize method is called, not by the property setter.

This property does not refer directly to a cascading style sheet (CSS). The property contains the name of an ASP.NET theme, which can include CSS files within it.

The StyleSheetTheme property specifies the name of a theme that is applied to a page early in the page life cycle, whereas the Theme property specifies the name of a theme that is applied to a page later in the page life cycle. This means that settings on the page take precedence over settings in the style sheet theme. For more information, see ASP.NET Themes and Skins.

You typically set a value for this property in the page directive or by overriding the property. For information, see the following topics:

.NET Framework

Supported in: 4, 3.5, 3.0, 2.0

Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows XP SP2 x64 Edition, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ
StyleSheetTheme setting applies CSS style sheets to design view in Visual Studio
The css files that you have located in the App_Themes/<Theme Name> are applied to the "Design" view only if you have used the Page.StyleSheetTheme property to set your theme.  This is really useful because you can actually see a close representation of what your actual website will look like when designing the presentation with css in Visual Studio.

In the Web.config the following is an example of setting your theme using StyleSheetTheme which applies the theme to the entire website (VS2010):
<pages styleSheetTheme="Default"controlRenderingCompatibilityVersion="4.0"clientIDMode="Static">

On the otherhand, if you use the Page.Theme property, the css files will not be applied to the Design view which makes it difficult to make any use of the Design view in Visual Studio.  Below is an example of the Theme setting in the Web.config file which applies the theme to the entire website (VS2010):
<pages theme="Default" controlRenderingCompatibilityVersion="4.0" clientIDMode="Static">