register css style sheet

  • Thread starter Thread starter Lukas Kurka
  • Start date Start date
L

Lukas Kurka

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

Lukas
 
See :

http://samples.gotdotnet.com/quickstart/aspplus/doc/webtemplates.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/
===================================
 
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
 
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

Back
Top