Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Add Css File

Reply
Thread Tools

Add Css File

 
 
shapper
Guest
Posts: n/a
 
      04-16-2008
Hello,

I am adding, in a page, a reference to a CSS file at runtime as
follows:

Dim base As HtmlGenericControl = New HtmlGenericControl("style")
With base
.Attributes.Add("type", "text/css")
.Attributes.Add("media", "Screen")
.InnerText = "@import url(App_Assets/PT/Styles/Base.css);"
End With
Page.Header.Controls.Add(base)

In which Page Event should I do this?

Thanks,

Miguel
 
Reply With Quote
 
 
 
 
nick chan
Guest
Posts: n/a
 
      04-16-2008
Init, page load or page complete . ur choice
On Apr 16, 8:51*am, shapper <(E-Mail Removed)> wrote:
> Hello,
>
> I am adding, in a page, a reference to a CSS file at runtime as
> follows:
>
> * * Dim base As HtmlGenericControl = New HtmlGenericControl("style")
> * * With base
> * * * .Attributes.Add("type", "text/css")
> * * * .Attributes.Add("media", "Screen")
> * * * .InnerText = "@import url(App_Assets/PT/Styles/Base.css);"
> * * End With
> * * Page.Header.Controls.Add(base)
>
> In which Page Event should I do this?
>
> Thanks,
>
> Miguel


 
Reply With Quote
 
 
 
 
Cowboy \(Gregory A. Beamer\)
Guest
Posts: n/a
 
      04-16-2008
This one is pretty wide open, as far as events, but why do this at all.

A better option, in many cases, is to set up themes. You can then use your
base class (from another thread) and set the theme there. Then you do not
end up creating dynamic links to CSS pages, which are harder to control.

--
Gregory A. Beamer
MVP, MCP: +I, SE, SD, DBA

Subscribe to my blog
http://gregorybeamer.spaces.live.com/lists/feed.rss

or just read it:
http://gregorybeamer.spaces.live.com/

*************************************************
| Think outside the box!
|
*************************************************
"shapper" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hello,
>
> I am adding, in a page, a reference to a CSS file at runtime as
> follows:
>
> Dim base As HtmlGenericControl = New HtmlGenericControl("style")
> With base
> .Attributes.Add("type", "text/css")
> .Attributes.Add("media", "Screen")
> .InnerText = "@import url(App_Assets/PT/Styles/Base.css);"
> End With
> Page.Header.Controls.Add(base)
>
> In which Page Event should I do this?
>
> Thanks,
>
> Miguel



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Possibility to add a zip-file to a new zip-file with "add to zip" (right-click) ?? erikkie@casema.nl Computer Support 4 06-26-2006 12:18 AM
CSS Layout question - how to duplicate a table layout with CSS Eric ASP .Net 4 12-24-2004 04:54 PM
Is there a way to set the a CSS property to be explicitly the same as another CSS property? Joshua Beall HTML 1 12-10-2003 07:21 PM
Dynamically add the stylesheet(.CSS file) VSK ASP .Net 3 11-25-2003 05:34 PM
print.css and screen.css tom watson HTML 1 09-09-2003 02:48 PM



Advertisments