473,396 Members | 2,021 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

register css style sheet

I know about registerclientscript, but is there something for stylesheet in
ASP.NET 2.0

Lukas
Oct 23 '06 #1
5 15663
Not as such, but you can dynamically allocate them via attributes if thats
what your looking for.

<head>
<link id="cssStyleSheet" rel="stylesheet" type="text/css" runat="server" />
</head>
Sub Page_Load(Sender As Object, E As EventArgs)
If Not (IsPostBack)
cssStyleSheet.Attributes.Add("href","Stylesheet1.c ss")
End If
End SubCant remember where I saw this but its probably what your looking
for.

Its about as close as you'll get to registerclientscript for css files.

--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
http://www.johntimney.com/blog


"Lukas Kurka" <ku******@seznam.czwrote in message
news:eh***********@ns.felk.cvut.cz...
>I know about registerclientscript, but is there something for stylesheet in
ASP.NET 2.0

Lukas

Oct 23 '06 #2
See :

http://samples.gotdotnet.com/quickst...templates.aspx

Everything about CSS works the same in ASP.NET as it does in HTML.

For a comprehensive CSS tutorial, see :
http://www.w3schools.com/css/default.asp

For an example of setting a CSS link programmaticaly in ASP.NET, see :
http://www.codeproject.com/aspnet/setcssfilelink.asp

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"Lukas Kurka" <ku******@seznam.czwrote in message news:eh***********@ns.felk.cvut.cz...
>I know about registerclientscript, but is there something for stylesheet in ASP.NET 2.0

Lukas

Oct 23 '06 #3
re:
Can't remember where I saw this
This looks identical...and he claims he couldn't find it on the Internet,
which is why he posted it at the Code Project :

http://www.codeproject.com/aspnet/setcssfilelink.asp


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"John Timney (MVP)" <x_****@timney.eclipse.co.ukwrote in message
news:uN********************@eclipse.net.uk...
Not as such, but you can dynamically allocate them via attributes if thats what your looking for.

<head>
<link id="cssStyleSheet" rel="stylesheet" type="text/css" runat="server" />
</head>
Sub Page_Load(Sender As Object, E As EventArgs)
If Not (IsPostBack)
cssStyleSheet.Attributes.Add("href","Stylesheet1.c ss")
End If
End SubCant remember where I saw this but its probably what your looking
for.

Its about as close as you'll get to registerclientscript for css files.

--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
http://www.johntimney.com/blog


"Lukas Kurka" <ku******@seznam.czwrote in message news:eh***********@ns.felk.cvut.cz...
>>I know about registerclientscript, but is there something for stylesheet in ASP.NET 2.0

Lukas


Oct 23 '06 #4
I guess that could be the origonal source......its a nice snippet!

--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
http://www.johntimney.com/blog
"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:eo**************@TK2MSFTNGP02.phx.gbl...
re:
>Can't remember where I saw this

This looks identical...and he claims he couldn't find it on the Internet,
which is why he posted it at the Code Project :

http://www.codeproject.com/aspnet/setcssfilelink.asp


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"John Timney (MVP)" <x_****@timney.eclipse.co.ukwrote in message
news:uN********************@eclipse.net.uk...
>Not as such, but you can dynamically allocate them via attributes if
thats what your looking for.

<head>
<link id="cssStyleSheet" rel="stylesheet" type="text/css" runat="server"
/>
</head>
Sub Page_Load(Sender As Object, E As EventArgs)
If Not (IsPostBack)
cssStyleSheet.Attributes.Add("href","Stylesheet1.c ss")
End If
End SubCant remember where I saw this but its probably what your looking
for.

Its about as close as you'll get to registerclientscript for css files.

--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
http://www.johntimney.com/blog


"Lukas Kurka" <ku******@seznam.czwrote in message
news:eh***********@ns.felk.cvut.cz...
>>>I know about registerclientscript, but is there something for stylesheet
in ASP.NET 2.0

Lukas



Oct 23 '06 #5
I used to use a list<stringon my base page class. On PreRender, I
bound the list to a repeater. It's low-tech but it means you can easily
swap CSS in and out.

Just add a BasePage.AddCss(string relativeFilePath) method and you're
away.

John Timney (MVP) wrote:
I guess that could be the origonal source......its a nice snippet!

--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
http://www.johntimney.com/blog
"Juan T. Llibre" <no***********@nowhere.comwrote in message
news:eo**************@TK2MSFTNGP02.phx.gbl...
re:
Can't remember where I saw this
This looks identical...and he claims he couldn't find it on the Internet,
which is why he posted it at the Code Project :

http://www.codeproject.com/aspnet/setcssfilelink.asp


Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
===================================
"John Timney (MVP)" <x_****@timney.eclipse.co.ukwrote in message
news:uN********************@eclipse.net.uk...
Not as such, but you can dynamically allocate them via attributes if
thats what your looking for.

<head>
<link id="cssStyleSheet" rel="stylesheet" type="text/css" runat="server"
/>
</head>
Sub Page_Load(Sender As Object, E As EventArgs)
If Not (IsPostBack)
cssStyleSheet.Attributes.Add("href","Stylesheet1.c ss")
End If
End SubCant remember where I saw this but its probably what your looking
for.

Its about as close as you'll get to registerclientscript for css files.

--
Regards

John Timney (MVP)
VISIT MY WEBSITE:
http://www.johntimney.com
http://www.johntimney.com/blog


"Lukas Kurka" <ku******@seznam.czwrote in message
news:eh***********@ns.felk.cvut.cz...
I know about registerclientscript, but is there something for stylesheet
in ASP.NET 2.0

Lukas
Oct 24 '06 #6

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

Similar topics

2
by: Mark | last post by:
Hi - I want to allow users of an intranet application, to select their own colours etc. So I have a tbale in my database, which has fields called bgcolour, fontcolour etc. As I want all pages...
2
by: Luke Bellamy | last post by:
Hi, I have been looking for a way to incorperate several different style sheets into a web page (i.e cascading effect). I have looked into the @import statement which seems to do what I want but...
19
by: Roger | last post by:
How can I pass parameters to a style sheet? I have noticed a couple of sites are now passing variables to the style sheet, which appear to be substituted at run time. For example: <link...
5
by: Andrew Poulos | last post by:
If I have an external stylesheet that is @imported into my page and it has an element that looks like this: * html td { font-style: italic; } how can I use javascript to change the font...
7
by: Daniel Kaplan | last post by:
I have the item below at the top of my style sheet. And it seems that the font-szie is ignored. I know that my linked style sheet is being read, and used because if I remove the font-family line,...
1
by: Amanda H. | last post by:
I posted about this a few days ago, and I got a few suggestions that fixed part of my problem. I am using a PHP script to switch external style sheets when the viewer clicks on the style link. ...
8
by: pamelafluente | last post by:
Hi guys, Is it possible to add "onload" (via Javascript) a new class to the <styleheader section? If yes, how would that be done ? <style type="text/css" media="screen"> .NewStyleClass{...
10
by: pamelafluente | last post by:
Hi, this time I am trying to add a style on the fly.I wish equivalency with this one (only the menuItemStyle line): <head> <style type="text/css" media="screen"> ... some static styles ......
4
by: fjm | last post by:
Hello everyone. I’d like to know how to handle multiple style sheets. I have css tabs that have a style sheet and then I also have a separate style sheet for the content that goes inside the tab. ...
4
Frinavale
by: Frinavale | last post by:
So a while ago I created a Tab Strip Control (before the AjaxToolkit had theirs otherwise I would have probably just used theirs). When I looked at the AjaxToolkit control to see how they got...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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
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
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,...

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.