Dynamically loading stylesheets

G

Guest

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
 
E

Eliyahu Goldin

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
 
G

Guest

Worked perfectly.

Many thanks.

Alan

Eliyahu Goldin said:
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
 

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,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top