Dynamic StyleSheet

J

Jurjen de Groot

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.
 
M

matt

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top