Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > register css dynamically in aspx page

Reply
Thread Tools

register css dynamically in aspx page

 
 
Ryan Liu
Guest
Posts: n/a
 
      03-16-2009
Hi,

There is method like
ClientScriptManager.IsClientScriptBlockRegistered( )
ClientScriptManager.RegisterClientScriptInclude()
method to handle javascript file, where isn't similar mechanism for css
file?

What is the best way to register external css file dynamically in aspx file?

For instance, I'd like to develop a user control which uses 3rd party
javascript file and css file to support a tree structure in browser. In the
user control, I want make the page uses this user control include necessary
js and css files.

Thanks a lot!
Ryan

 
Reply With Quote
 
 
 
 
Alexey Smirnov
Guest
Posts: n/a
 
      03-16-2009
On Mar 16, 1:30*am, "Ryan Liu" <(E-Mail Removed)> wrote:
> Hi,
>
> There is method like
> * * ClientScriptManager.IsClientScriptBlockRegistered( )
> * * ClientScriptManager.RegisterClientScriptInclude()
> *method to handle javascript file, where isn't similar mechanism for css
> file?
>
> What is the best way to register external css file dynamically in aspx file?
>
> For instance, I'd like to develop a user control which uses 3rd party
> javascript file and css file to support a tree structure in browser. *In the
> user control, I want make the page uses this user control include necessary
> js and css files.
>
> Thanks *a lot!
> Ryan


Hi Ryan

add runat="server" to the head tag

<head runat="server" id="head">

then in Page_Load:

Dim lc As New Literal
lc.Text = "<link rel=""Stylesheet"" type=""text/css""
href=""styles.css"">"
Me.FindControl("head").Controls.Add(lc)

Hope this helps
 
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
Dynamically add aspx snippet into a given aspx page ColdAir ASP .Net 1 02-26-2009 12:49 AM
adding main.aspx.vb & main.aspx.resx under aspx John M ASP .Net 1 05-29-2005 09:27 PM
How to Dynamically Link CSS file to an ASPX Page? Jeremy ASP .Net 1 06-24-2004 05:25 PM
Adding a Register directive to an aspx page programmatically Arnaud PICHERY ASP .Net Building Controls 1 11-18-2003 07:39 AM
How I can I add a Register directive programmatically to an aspx page from a ControlDesigner? Arnaud PICHERY ASP .Net Web Controls 0 11-14-2003 10:57 PM



Advertisments