Register   Login
     
  Categories  
  Archives  
  Authors  
  Blog  
20

There are 3 ways to specify a theme in ASP.NET 2.0:-

1.) Through the page directive.

<%@ Page Language="VB" MasterPageFile="~/Templates/Drakkar.master" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" title="Untitled Page" Theme="Red" %>

2.) Through the web.config file.

<pages theme="Red"> (thank god for web.config Intellisense)

(thank god for web.config Intellisense)

3.) Through code.

Protected Sub Page_PreInit(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.PreInit

Page.Theme = "Red"

End Sub

Posted in: ASP.NET 2.0

Post Rating

Comments

lomaxx
# lomaxx
Monday, November 21, 2005 8:12 PM
On a side note, with the new sitemap xml control, it would be cool if you could specify themes using the sitemap so that all nodes under a particular root node could then inherit a particular theme. This would be particularly useful if you have a number of categories and want to apply a theme to each different category. Under each category could be a few pages, but if you decide that you want to change the location of the page, you don't have to change the masterpage because it would already be defined in the sitemap... just a thought
joerattz
# joerattz
Friday, January 20, 2006 8:07 AM
Using theme in the web.config file only causes the theme to render at run time. This means you aren't seeing your theme in the design view.

There is another option you can specify in web.config named styleSheetTheme that you set the same way, and that will cause your theme to render both at run time and design time. But, I don't feel like it renders the theme all that well at design time even then.
Dennis Betten
# Dennis Betten
Tuesday, January 23, 2007 7:03 AM
Setting the theme in your web.config creates a problem.
When publishing your website, automatically the theme is included in every webpage. Now if you want to simply copy a new theme to your website and refer to it in your web.config, it offcourse doesn't change all your webpages. This means it still uses the theme with which you published.

Solution is to manually remove all the Theme references from all your webpages. (when testing, be aware of caching!!)

If anyone finds a better solution to this problem, please mail me and post your solution in tis topic. Thanx!!

Post Comment

Name (required)

Email (required)

Website

Enter the code shown above: