Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP.NET 2.0: Skin files only work when placed at the root theme folder?

Tags:

asp.net

themes

I have found that skin files only work if they are placed at the root theme folder in the App_Themes folder.

For example, if you have 2 themes in the App_Themes folder, you cannot add another sub folder to the theme folder and place a seperate skin file in that subfolder.

It's not much of a limitation, but it would give you more flexibility to further customize an app.

Can anyone shed light on why this behavior occurs as it does in 2.0?


2 Answers

Has your skin file should have the extension .skin? I always call them theme.skin and give them the same name as the folder. Eg in Theme col2, the folder is

App_Themes\col2 and contains the css and col2.skin

Microsoft is your best reference:

Themes in ASP.Net don't provide the ability to choose from "sub-themes".

However, you can set SkinIDs in your skin files. For example, in your .skin :

<asp:DataList runat="server" SkinID="DataListColor" Width="100%">
  <ItemStyle BackColor="Blue" ForeColor="Red" />
</asp:DataList>

<asp:DataList runat="server" SkinID="DataListSmall" Width="50%">
</asp:DataList>

Then, when you want to call one of them, you just specify which SkinID you want for your datalist.

like image 34
thomasb Avatar answered Dec 30 '25 17:12

thomasb