Monday, January 7, 2008

Getting Themes to work in Visual Studio 2005 Designer

Have you created a new ASP.NET web site, theme and master page and then been frustrated because you can't view the theme in the Visual Studio .NET 2005 designer? Well if you haven't, I sure have. I kept setting the web.config pages theme="themename" property, thinking that was all I needed to do. Setting this property sets the default theme for your site when you build the site, but it will not be reflected in Visual Studio .NET 2005 Designer mode for some reason.

After doing a lot of searching, I found out that you need to set the following property in your web.config (or your Page attribute if you are setting the Theme on a per page basis) to get your Theme to work in Visual Studio.

<pages styleSheetTheme="default" />



Anonymous said...

Thanks, that was helpful. Just one point - only use "default" if that's the name of the theme that you want to use. My theme was called "Professional" and when I added pages styleSheetTheme="default", I got an error because I don't have a theme named default. I changed it to styleSheetTheme= "Professional" and it worked perfectly.

Anonymous said...

Thanks, that solved my case as well. The same issue happens in VS 2008 - I need to have defined pages with both "theme" and "styleSheetTheme" defined. Couldn't find that anywhere :-)