Adding style sheet dynamicaly

  • Thread starter Thread starter Marc Nederhoff
  • Start date Start date
M

Marc Nederhoff

Hi all,

Is it possible to add the <link rel="stylesheet"....> dynamicaly. All pages
in my site use the same style sheet, and I don't want to add the link
manualy because of maintenance.

Marc
 
There's no stylesheet control i'm aware of otherwise that would be the best
option.
I'd say you can either do one of two options
1. Create a Literal control and set the text to equal "<link
rel=\"stylesheet\" src=\"" + stylesource + \"">" at runtime
2. Set a variable in your Page_Load event and then bind or write this to
your link tag. <link rel="stylesheet" src="<%= stylesource%>">
 
If you look at the forum system at http://synthigence.com/forum which you
could modify...

It has a "Styler" control which you put on every page. If you make it
invisible, it looks in a table and sets a stylesheet value. If it is
visible, it displays a dropdown of available stylesheets and remembers which
the user selected (in a cookie).

charles
 
Back
Top