Search code examples
asp.netskin

How to change skins in ASP.NET?


I have a very basic question, but I don't know the answer, unfortunately, google-ing didn't help.

I have a solution where I have two projects, project A and project B. Both of them use a Default.skin file for theme-ing in their AppThemes. However, I want to use Default.skin from project B in project A if a certain condition is met. How can I achieve this?

Thanks in advance for any reply.


Solution

  • Use the @Page directive and set Theme or StyleSheetTheme. There are some scope differences depending on what you use.

    You can also set it in the web.config on the <pages> element. MSDN link.

    Or, you can set it programatically in Page_PreInit by setting Page.Theme, which may be what you need if you need to set it conditionally depending on A or B.