Add Css File
am 16.04.2008 02:51:30 von Shapper
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
Re: Add Css File
am 16.04.2008 07:15:28 von Nick Chan
Init, page load or page complete . ur choice
On Apr 16, 8:51=A0am, shapper wrote:
> Hello,
>
> I am adding, in a page, a reference to a CSS file at runtime as
> follows:
>
> =A0 =A0 Dim base As HtmlGenericControl =3D New HtmlGenericControl("style")=
> =A0 =A0 With base
> =A0 =A0 =A0 .Attributes.Add("type", "text/css")
> =A0 =A0 =A0 .Attributes.Add("media", "Screen")
> =A0 =A0 =A0 .InnerText =3D "@import url(App_Assets/PT/Styles/Base.css);"
> =A0 =A0 End With
> =A0 =A0 Page.Header.Controls.Add(base)
>
> In which Page Event should I do this?
>
> Thanks,
>
> Miguel
Re: Add Css File
am 16.04.2008 18:56:35 von NoSpamMgbworld
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" wrote in message
news:f770d4a2-4f34-4d5e-a3d9-9cefbbbb9a16@8g2000hse.googlegr oups.com...
> 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