473,486 Members | 2,353 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Dynamically loading stylesheets

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
Nov 18 '05 #1
3 1076
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" <Al*********@discussions.microsoft.com> wrote in message
news:18**********************************@microsof t.com...
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

Nov 18 '05 #2
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" <Al*********@discussions.microsoft.com> wrote in message
news:18**********************************@microsof t.com...
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


Nov 18 '05 #3
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" <Al*********@discussions.microsoft.com> wrote in message
news:18**********************************@microsof t.com...
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


Nov 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2850
by: wjbell | last post by:
I have a piece of javascript I need to modify. Right now it changes a stylesheet in the document between style.css and no_indent.css. These are in the head of my document: <link rel=stylesheet...
7
13970
by: Winston | last post by:
Hi, I want to use the Webbrowser Control (the Internet Explorer Control) to display an XML-structure within a C# WinForm. The way the IE displays a XML-file in its native form is exactly what I...
1
3004
by: Kamal Jeet Singh | last post by:
Hi Friends !! I am have facing problem in controlling the dynamically created controls on web page. The problem Scenario is Scenario:- My requirement is to load the web user controls on the...
1
2554
by: Kamal Jeet Singh | last post by:
Hi Friends !! I am facing problem in controlling the dynamically created controls on web page. The problem Scenario is Scenario:- My requirement is to load the web user controls on the web...
6
6863
by: Dan Dorey | last post by:
I actually have two questions here, but I'll start by giving an outline of what I'm trying to do. I'm building an app with a simple plugin architecture (all in the same app domain). I have each...
4
3627
by: Ed Jay | last post by:
I generate a DHTML page (a medical report) with dynamically generated text based on user input (answers to questions). The page length changes dynamically. I desire that when the page is printed...
1
1826
by: Bob Rock | last post by:
Hello, I'm new to ASP.NET and I've been looking into the topic of dynamically loading (typically accomplished with a LoadControl followed by a MyControl.Controls.Add()) both user controls and...
5
1565
by: maya | last post by:
hi, I'm using this script to switch stylesheets dynamically (in response to user input..) http://www.dynamicdrive.com/dynamicindex9/stylesheetswitcher.htm (sorry can't show url, am in...
2
2649
by: TAL651 | last post by:
Hello, I'd like to use XML + XSLT to create a sortable table. The XML stores the data, and two different XSL stylesheets display the table, sorted in two different ways. What I don't understand...
6
2538
by: _Who | last post by:
I use the code below to change to a style sheet that has: body { ....
0
7105
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6967
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7132
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6846
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7341
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5439
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3076
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1381
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
600
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.