Home All Groups Group Topic Archive Search About

Problem using themes in web user controls

Author
11 Dec 2006 10:58 AM
Geoff
I cannot get my app to compile because there is no way to tell the web user
control which theme to use and hence all of my links within that theme
(images, css) are wrong.

I think I should be able to do this on the server side programatically but
that surely cant be the best way.

Has any one got any ideas?

Author
11 Dec 2006 1:38 PM
Geoff
"Geoff" wrote:

> I think I should be able to do this on the server side programatically but
> that surely cant be the best way.

imgLogin.Src = string.Format("~/App_Themes/{0}/Images/login.gif",
this.Page.StyleSheetTheme.ToString());

This is how I am currently doing it. This is identical to the way I was
doing it for .net 1.1 (except I pulled the value from my own base class
property that was intern pulled from a db)

I don't know if I will get a better answer but it just feels like all of
this should be in the theme.

If I dont get a suitable answer I will just write something in the base
class which will cycle round my image controls and update the reference
automatically. Although this means I will have to statically point all images
to the a app_themes folder in design mode.
Author
12 Dec 2006 3:25 PM
Geoff
Hmmm its amazing how you can ramble about wrong asnwers when there is a
really simple solution staring you in the face. Anyway, after some advice via
a different thread I decided to replace the server side code with skin files.

It has just taken me the best part of 8 hours to do a small site (10 aspx,
14 ascx with 120 skin entries). I can honestly say it was worth the effort.


Show quoteHide quote
"Geoff" wrote:

> "Geoff" wrote:
>
> > I think I should be able to do this on the server side programatically but
> > that surely cant be the best way.
>
> imgLogin.Src = string.Format("~/App_Themes/{0}/Images/login.gif",
> this.Page.StyleSheetTheme.ToString());
>
> This is how I am currently doing it. This is identical to the way I was
> doing it for .net 1.1 (except I pulled the value from my own base class
> property that was intern pulled from a db)
>
> I don't know if I will get a better answer but it just feels like all of
> this should be in the theme.
>
> If I dont get a suitable answer I will just write something in the base
> class which will cycle round my image controls and update the reference
> automatically. Although this means I will have to statically point all images
> to the a app_themes folder in design mode.