473,387 Members | 1,721 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Adding style sheet dynamicaly

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
Nov 17 '05 #1
2 1321
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%>">

"Marc Nederhoff" <ma**@netmatch.nl> wrote in message
news:bo**********@news.cistron.nl...
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

Nov 17 '05 #2
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

"Janaka" <ja****@magicalia.com> wrote in message
news:Of**************@TK2MSFTNGP12.phx.gbl...
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%>">

"Marc Nederhoff" <ma**@netmatch.nl> wrote in message
news:bo**********@news.cistron.nl...
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


Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Mark | last post by:
Hi - I want to allow users of an intranet application, to select their own colours etc. So I have a tbale in my database, which has fields called bgcolour, fontcolour etc. As I want all pages...
2
by: Luke Bellamy | last post by:
Hi, I have been looking for a way to incorperate several different style sheets into a web page (i.e cascading effect). I have looked into the @import statement which seems to do what I want but...
5
by: Andrew Poulos | last post by:
If I have an external stylesheet that is @imported into my page and it has an element that looks like this: * html td { font-style: italic; } how can I use javascript to change the font...
7
by: Daniel Kaplan | last post by:
I have the item below at the top of my style sheet. And it seems that the font-szie is ignored. I know that my linked style sheet is being read, and used because if I remove the font-family line,...
8
by: pamelafluente | last post by:
Hi guys, Is it possible to add "onload" (via Javascript) a new class to the <styleheader section? If yes, how would that be done ? <style type="text/css" media="screen"> .NewStyleClass{...
10
by: pamelafluente | last post by:
Hi, this time I am trying to add a style on the fly.I wish equivalency with this one (only the menuItemStyle line): <head> <style type="text/css" media="screen"> ... some static styles ......
1
by: tributek | last post by:
Hello, I work on a report and everything is going well... excepted the export. I have groups defined in the report so each differente groups will appear in a new sheet in Excel. Great! ...
4
by: fjm | last post by:
Hello everyone. I’d like to know how to handle multiple style sheets. I have css tabs that have a style sheet and then I also have a separate style sheet for the content that goes inside the tab. ...
4
Frinavale
by: Frinavale | last post by:
So a while ago I created a Tab Strip Control (before the AjaxToolkit had theirs otherwise I would have probably just used theirs). When I looked at the AjaxToolkit control to see how they got...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.