473,383 Members | 1,919 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,383 software developers and data experts.

Dynamic StyleSheet

Is it possible to Dynamically set the StyleSheet to be used on a page,
depending on who is logged on to your web-app ?

<LINK href="../Css/MyStyleSheet.css" type="text/css" rel="stylesheet" > or
<LINK href="../Css/HerStyleSheet.css" type="text/css" rel="stylesheet" >
Kind regards,

Jurjen de Groot
Netherlands.

Nov 18 '05 #1
1 921
Just use the following tag in your aspx page

<LINK runat=server id=cssLink />

then in your codebehind page you can add the required attributes

cssLink.Attributes.Add("href","../Css/MyStyleSheet.css");
cssLink.Attributes.Add("type","text/css");
cssLink.Attributes.Add("rel","stylesheet");

Obviously you'll have to declare the Link tag in your codebehind first ....

protected System.Web.Ui.HtmlControls.HtmlGenericControl cssLink;

Just add in whatever conditional logic you need.

Matt
http://www.3internet.com
"Jurjen de Groot" <jd*********@xs4all.nl> wrote in message
news:Oe**************@TK2MSFTNGP10.phx.gbl...
Is it possible to Dynamically set the StyleSheet to be used on a page,
depending on who is logged on to your web-app ?

<LINK href="../Css/MyStyleSheet.css" type="text/css" rel="stylesheet" > or <LINK href="../Css/HerStyleSheet.css" type="text/css" rel="stylesheet" >
Kind regards,

Jurjen de Groot
Netherlands.

Nov 18 '05 #2

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

Similar topics

0
by: Ex-Em-El | last post by:
I have a problem in creating a dynamic table in the same xml : 1.xml: <?xml version="1.0" standalone="yes"?> <?xml-stylesheet type="text/xsl" href="2.xsl"?> <aaa...
1
by: Manu | last post by:
Hello, i ve again a little problem with my dynamic web site... i need to insert a dynamic link (css) into my body ! Why ? because i've a html template and i insert into the body a dynamic...
3
by: Capricorn | last post by:
Hi, can anybody tell me how you can create a new stylesheet inside a (X)HTML page with JavaScript and Firefox, if the stylesheet is only available as a variable value, like: var CSSStyle =...
1
by: davidfahy | last post by:
Hi all, I have an aspx page and have written a general css stylesheet to brand the page. However I want to make the header image dynamic. Basically a link to the image will be passed to me in the...
2
by: JWL | last post by:
Hi I need to create a bunch of sites with slightly dynamic CSS. Basically, all the image paths in the CSS need to be dynamic, depending on the values of certain ASP variables. I can think of...
5
by: Daniel Frey | last post by:
Hello I'd like to match a dynamic node, given as a parameter to the stylesheet. Something like: <xsl:stylesheet ...> <xsl:param name="tomatch"/> <xsl:template match="{$tomatch}"> Hallo...
2
by: JJA | last post by:
I'm trying this technique I found on Digital-Web.com in an attempt to set different stylesheets based on the width of the screen. Even when I resize the screen to my max of 1280x1024 I always get...
1
by: Puja | last post by:
hi all, On my page, i have external stylesheet <link id="sbSiteCSS" rel="stylesheet" type="text/css" runat="server" /> whose href is determined on page_load protected void Page_Load(object...
3
polymorphic
by: polymorphic | last post by:
I have succeeded in embedding PDF files in a dynamic iframe. The problem is that I need the PDF to cache. If the PDF remains the same from page load to page load then the pdf is somehow cached with...
3
by: =?Utf-8?B?U3ViYQ==?= | last post by:
I am using a asp page to dynamically create a stylesheet my asp page creates the following css element when i call the asp page my typing the url in the browser. My asp page works...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.