Add Css File

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 = " [at] 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
Shapper [ Mi, 16 April 2008 02:51 ] [ ID #1943398 ]

Re: Add Css File

Init, page load or page complete . ur choice
On Apr 16, 8:51=A0am, shapper <mdmo... [at] gmail.com> 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 " [at] 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
Nick Chan [ Mi, 16 April 2008 07:15 ] [ ID #1943406 ]

Re: Add Css File

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" <mdmoura [at] gmail.com> wrote in message
news:f770d4a2-4f34-4d5e-a3d9-9cefbbbb9a16 [at] 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 = " [at] 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
NoSpamMgbworld [ Mi, 16 April 2008 18:56 ] [ ID #1943511 ]
Microsoft » microsoft.public.dotnet.framework.aspnet » Add Css File

Vorheriges Thema: Visual Studio keeps adding Oracle assemblies to web.config
Nächstes Thema: Culture