views:

125

answers:

4

I'm using logos as just an example.

I'm trying to use themes/skins for the first time in ASP.NET - and just trying to figure out exactly what they will allow me to do.

As far as i can tell themes are primarily for changing controls like buttons, which can be modified using images. But is there a way I can skin a 'logo' or other graphics using themes? Reading the documentation I couldnt immediately see a way of doing so.

A: 

Typically the best way to achieve this is through the use of Master Pages and CSS.

Develop your master pages and their layouts as you like, and then apply CSS stylesheets to the master page as you like. The benefit of this approach is that you'll be able to change the style with one change, and it'll cascade throughout your application wherever the master page is used.

Here's an article: ASP.NET Master Pages Template Set

p.campbell
Using ASP.NET themes is much more flexible than using straight master pages and CSS.
Daniel Schaffer
A: 

using the themes you could easily set the source of an Image ASP.NET control to be different per theme. (also the sizes if they were different).

Themes overview: http://msdn.microsoft.com/en-us/library/ykzx33wh.aspx

Jeff Martin
+3  A: 

You can easily set an image/logo using themes/skins. E.g. if you have an image control like this:

<asp:Image id="imgLogo" runat="server" SkinId="logo" ... />

In your skin files, you can then specifiy the image to be displayed, e.g. in App_Themes/theme1/logo.skin:

<asp:Image runat="server" SkinId="logo" ImageUrl="~/images/logo1.png" />

And in App_Themes/theme2/logo.skin:

<asp:Image runat="server" SkinId="logo" ImageUrl="~/images/logo2.png" />

This is not limited to the ImageUrl property. You can set most of the properties of controls from skin files.

M4N
A: 

I recently used ASP.net themes to create a dynamically branded site with different logos and other images depending on the affiliate that sent the user to the site. This sounds like what you are going for. To accomplish this, I did the following:

  1. Created several themes, including css and images (no skin files were used). You can use relative references in your css to display background images stored in your theme folder.
  2. Created my own page class that overrides the OnPreInit event and sets Page.Theme to whatever theme I determine should be used. This is based on cookies for me, but could be based on any way you want to identify the user.
  3. Make sure that all your pages inherit from your new page class.
AJ