Dynamic StyleSheet

Discussion in 'ASP .Net' started by Jurjen de Groot, Feb 26, 2004.

  1. 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.
     
    Jurjen de Groot, Feb 26, 2004
    #1
    1. Advertising

  2. Jurjen de Groot

    matt Guest

    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" <> wrote in message
    news:OeJZMkH$...
    > 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.
    >
    >
    >
     
    matt, Feb 27, 2004
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?SUdvdFlvdXJEb3ROZXQ=?=

    dynamic stylesheet

    =?Utf-8?B?SUdvdFlvdXJEb3ROZXQ=?=, Aug 26, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    477
    Eliyahu Goldin
    Aug 26, 2004
  2. =?ISO-8859-1?Q?J=F8rn_Tommy_Kinder=E5s?=

    Stylesheet referanse i stylesheet

    =?ISO-8859-1?Q?J=F8rn_Tommy_Kinder=E5s?=, Jul 3, 2004, in forum: XML
    Replies:
    3
    Views:
    591
    =?ISO-8859-1?Q?J=F8rn_Tommy_Kinder=E5s?=
    Jul 4, 2004
  3. Steven An
    Replies:
    1
    Views:
    512
    Martin Honnen
    Nov 23, 2004
  4. David Blickstein
    Replies:
    3
    Views:
    1,054
    David Blickstein
    Aug 2, 2005
  5. David Blickstein
    Replies:
    14
    Views:
    6,383
    Harrie
    Oct 16, 2005
Loading...

Share This Page