Dynamic StyleSheet

  • Thread starter Thread starter Jurjen de Groot
  • Start date Start date
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.
 
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
 
Back
Top