|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Dynamically adding a stylesheetI want to dynamically add a stylesheet using <style type="text/css"></style>
tags. The code that will use this stylesheet will be shared, so I will not have control over what the user does as far as stuff like adding runat="server" and id="someid" attributes to the <head> tag of their .aspx page. I was wondering if there is a way similar to the RegisterClientScriptBlock method that can be used. Any ideas or suggestions? Thanks. Actually, I believe you can get away with RegisterClientScriptBlock even
though it is not "script". Try it. Peter -- Show quoteHide quoteCo-founder, Eggheadcafe.com developer portal: http://www.eggheadcafe.com UnBlog: http://petesbloggerama.blogspot.com "Nathan Sokalski" wrote: > I want to dynamically add a stylesheet using <style type="text/css"></style> > tags. The code that will use this stylesheet will be shared, so I will not > have control over what the user does as far as stuff like adding > runat="server" and id="someid" attributes to the <head> tag of their .aspx > page. I was wondering if there is a way similar to the > RegisterClientScriptBlock method that can be used. Any ideas or suggestions? > Thanks. > -- > Nathan Sokalski > njsokal***@hotmail.com > http://www.nathansokalski.com/ > > > Thanks! It may not be the intended purpose, or even inside the <head> tag,
but it's good enough for me, and it works. Show quoteHide quote "Peter Bromberg [C# MVP]" <pbromberg@yahoo.nospammin.com> wrote in message news:05979FBF-CEE3-46B4-9E23-A10A92FFDA94@microsoft.com... > Actually, I believe you can get away with RegisterClientScriptBlock even > though it is not "script". Try it. > Peter > > -- > Co-founder, Eggheadcafe.com developer portal: > http://www.eggheadcafe.com > UnBlog: > http://petesbloggerama.blogspot.com > > > > > "Nathan Sokalski" wrote: > >> I want to dynamically add a stylesheet using <style >> type="text/css"></style> >> tags. The code that will use this stylesheet will be shared, so I will >> not >> have control over what the user does as far as stuff like adding >> runat="server" and id="someid" attributes to the <head> tag of their >> .aspx >> page. I was wondering if there is a way similar to the >> RegisterClientScriptBlock method that can be used. Any ideas or >> suggestions? >> Thanks. >> -- >> Nathan Sokalski >> njsokal***@hotmail.com >> http://www.nathansokalski.com/ >> >> >> I cheat. I've got two repeaters defined in my masterpages, one for
scripts, one for CSS. My base page class has a couple of List<string>'s and I just call AddResource("path/to/file", ResourceType.Css) to add resources to those Lists Then I bind the repeaters on PreRender so any page events have an opportunity to add CSS/Js that'll be needed on the client. It's a hack, but I like my stylesheets and scripts in external files referenced in the head where they belong. Flinky Wisty Pomm wrote:
> I cheat. I've got two repeaters defined in my masterpages, one for That sounds like a much better solution. A <script> tag inside the body is > scripts, one for CSS. My base page class has a couple of List<string>'s > and I just call > AddResource("path/to/file", ResourceType.Css) to add resources to those > Lists > > Then I bind the repeaters on PreRender so any page events have an > opportunity to add CSS/Js that'll be needed on the client. It's a hack, > but I like my stylesheets and scripts in external files referenced in > the head where they belong. > ugly (and invalid XHTML, I believe). And a <style> tag in the body is just invalid in both HTML and XHTML. And we all know that production-quality controls generate valid XHTML at least, right? ;) -- Thanks, Martijn Saly Flinky Wisty Pomm,
Can you please show an example. why repeaters...>??? Thank you, Sa Show quoteHide quote "Flinky Wisty Pomm" <Pathoge***@gmail.com> wrote in message news:1147161222.017984.44680@e56g2000cwe.googlegroups.com... >I cheat. I've got two repeaters defined in my masterpages, one for > scripts, one for CSS. My base page class has a couple of List<string>'s > and I just call > AddResource("path/to/file", ResourceType.Css) to add resources to those > Lists > > Then I bind the repeaters on PreRender so any page events have an > opportunity to add CSS/Js that'll be needed on the client. It's a hack, > but I like my stylesheets and scripts in external files referenced in > the head where they belong. > I don't get it but <%= ... > should do??
I'm using it for resolving the script url. Show quoteHide quote "Nathan Sokalski" <njsokal***@hotmail.com> schreef in bericht news:OBpEhuucGHA.5048@TK2MSFTNGP03.phx.gbl... >I want to dynamically add a stylesheet using <style >type="text/css"></style> tags. The code that will use this stylesheet will >be shared, so I will not have control over what the user does as far as >stuff like adding runat="server" and id="someid" attributes to the <head> >tag of their .aspx page. I was wondering if there is a way similar to the >RegisterClientScriptBlock method that can be used. Any ideas or >suggestions? Thanks. > -- > Nathan Sokalski > njsokal***@hotmail.com > http://www.nathansokalski.com/ > <%=...%> would be fine if I was writing the webform that used the
stylesheet, but I am not writing the webform, I am writing a couple external classes that will be used with webforms. Show quoteHide quote "Edwin Knoppert" <n***@hellobasic.com> wrote in message news:4460b513$0$2022$ba620dc5@text.nova.planet.nl... >I don't get it but <%= ... > should do?? > I'm using it for resolving the script url. > > > "Nathan Sokalski" <njsokal***@hotmail.com> schreef in bericht > news:OBpEhuucGHA.5048@TK2MSFTNGP03.phx.gbl... >>I want to dynamically add a stylesheet using <style >>type="text/css"></style> tags. The code that will use this stylesheet will >>be shared, so I will not have control over what the user does as far as >>stuff like adding runat="server" and id="someid" attributes to the <head> >>tag of their .aspx page. I was wondering if there is a way similar to the >>RegisterClientScriptBlock method that can be used. Any ideas or >>suggestions? Thanks. >> -- >> Nathan Sokalski >> njsokal***@hotmail.com >> http://www.nathansokalski.com/ >> > > K.Scott Allen provided a useful trick for doing that.
The ContentPlaceHolder ¨C Not Just For Content http://odetocode.com/Blogs/scott/archive/2006/04/10/3258.aspx
Date Errors in .NET 2.0
VB .NET very slow in design control array question for VB.Net 2005 File copy VB Exp 2005 Thread Sync Queue Problem umanaged code - array error Outlook Add In is not shown for 1 user... Standarddrucker mit .Net ermitteln Option Strict On does not cause compilation error Ignoring mouse event from contained controls |
|||||||||||||||||||||||