Dynamically loading stylesheets

Discussion in 'ASP .Net' started by =?Utf-8?B?QWxhbiBMYW1iZXJ0?=, Nov 23, 2004.

  1. I have an ASP.Net page which, depending on a parameter being passed via the
    QueryString, needs to use a different stylesheet.

    I've tried creating a runat="server" version of the link tag:

    <link rel="stylesheet" type="text/css" href="" id="pageStyle" runat="server"

    and then accessing it via code:

    Select Case Request.QueryString("page")
    Case "whiteboard"
    pageStyle.href= "whiteboard.css"
    Case ...
    End Select

    but this doesn't work.

    How should I go about acheiving this?

    Many thanks for any any help

    Alan
    =?Utf-8?B?QWxhbiBMYW1iZXJ0?=, Nov 23, 2004
    #1
    1. Advertising

  2. Alan,

    Amongst a number of ways of doing that the most common one is adding a
    literal control to the <head> section and setting it's text in code-behind
    to <link...>.

    Eliyahu

    "Alan Lambert" <> wrote in message
    news:...
    > I have an ASP.Net page which, depending on a parameter being passed via

    the
    > QueryString, needs to use a different stylesheet.
    >
    > I've tried creating a runat="server" version of the link tag:
    >
    > <link rel="stylesheet" type="text/css" href="" id="pageStyle"

    runat="server"
    >
    > and then accessing it via code:
    >
    > Select Case Request.QueryString("page")
    > Case "whiteboard"
    > pageStyle.href= "whiteboard.css"
    > Case ...
    > End Select
    >
    > but this doesn't work.
    >
    > How should I go about acheiving this?
    >
    > Many thanks for any any help
    >
    > Alan
    Eliyahu Goldin, Nov 23, 2004
    #2
    1. Advertising

  3. Worked perfectly.

    Many thanks.

    Alan

    "Eliyahu Goldin" wrote:

    > Alan,
    >
    > Amongst a number of ways of doing that the most common one is adding a
    > literal control to the <head> section and setting it's text in code-behind
    > to <link...>.
    >
    > Eliyahu
    >
    > "Alan Lambert" <> wrote in message
    > news:...
    > > I have an ASP.Net page which, depending on a parameter being passed via

    > the
    > > QueryString, needs to use a different stylesheet.
    > >
    > > I've tried creating a runat="server" version of the link tag:
    > >
    > > <link rel="stylesheet" type="text/css" href="" id="pageStyle"

    > runat="server"
    > >
    > > and then accessing it via code:
    > >
    > > Select Case Request.QueryString("page")
    > > Case "whiteboard"
    > > pageStyle.href= "whiteboard.css"
    > > Case ...
    > > End Select
    > >
    > > but this doesn't work.
    > >
    > > How should I go about acheiving this?
    > >
    > > Many thanks for any any help
    > >
    > > Alan

    >
    >
    >
    =?Utf-8?B?QWxhbiBMYW1iZXJ0?=, Nov 23, 2004
    #3
  4. Hi Alan...
    Can you POST the code how u did it!
    Thanks


    "Alan Lambert" wrote:

    > Worked perfectly.
    >
    > Many thanks.
    >
    > Alan
    >
    > "Eliyahu Goldin" wrote:
    >
    > > Alan,
    > >
    > > Amongst a number of ways of doing that the most common one is adding a
    > > literal control to the <head> section and setting it's text in code-behind
    > > to <link...>.
    > >
    > > Eliyahu
    > >
    > > "Alan Lambert" <> wrote in message
    > > news:...
    > > > I have an ASP.Net page which, depending on a parameter being passed via

    > > the
    > > > QueryString, needs to use a different stylesheet.
    > > >
    > > > I've tried creating a runat="server" version of the link tag:
    > > >
    > > > <link rel="stylesheet" type="text/css" href="" id="pageStyle"

    > > runat="server"
    > > >
    > > > and then accessing it via code:
    > > >
    > > > Select Case Request.QueryString("page")
    > > > Case "whiteboard"
    > > > pageStyle.href= "whiteboard.css"
    > > > Case ...
    > > > End Select
    > > >
    > > > but this doesn't work.
    > > >
    > > > How should I go about acheiving this?
    > > >
    > > > Many thanks for any any help
    > > >
    > > > Alan

    > >
    > >
    > >
    =?Utf-8?B?UGF0cmljay5PLklnZQ==?=, Nov 24, 2004
    #4
    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. Adrian

    Changing stylesheets

    Adrian, Oct 27, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    327
    Esteban Felipe
    Oct 27, 2003
  2. ADRIAN

    Changeing Stylesheets

    ADRIAN, Nov 5, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    359
    ADRIAN
    Nov 5, 2003
  3. Andries
    Replies:
    5
    Views:
    4,454
    Sean Jorden
    Sep 9, 2003
  4. jim
    Replies:
    1
    Views:
    728
    Wizfrog
    Jul 24, 2007
  5. maya

    switching stylesheets dynamically..

    maya, Feb 1, 2007, in forum: Javascript
    Replies:
    5
    Views:
    96
    -Lost
    Feb 1, 2007
Loading...

Share This Page