register css style sheet

L

Lukas Kurka

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

Lukas
 
J

John Timney \(MVP\)

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.css")
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
 
F

Flinky Wisty Pomm

I used to use a list<string> on 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.
 

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

Similar Threads


Members online

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,007
Latest member
obedient dusk

Latest Threads

Top