>I'll bet it did take some time.
>Thanks for sharing.
>I need to change the entire style sheet file.
>I'm not sure but I think this code is for changing one rule at a time.
>news:%23KK9IxSGJHA.5944@TK2MSFTNGP03.phx.gbl...
Quote:
>>Use the following code:
>>>
>>this.Page.Header.StyleSheet.CreateStyleRule(ne w
>>CustomStyle("background-color:black;"), null, "body");
>>>
>>The two important parameters in this method are the first one, which is
>>a Style object, and the third one, which is the selector to be used with
>>the style rule. You will also need to include the following class:
>>>
>>public class CustomStyle : System.Web.UI.WebControls.Style
>>{
>> private System.Web.UI.CssStyleCollection currstyles;
>>>
>> public CustomStyle(System.Web.UI.CssStyleCollection custom) {
>>this.currstyles = custom; }
>> public CustomStyle(string cssvalue)
>> {
>> System.Web.UI.CssStyleCollection tempstyle = new
>>System.Web.UI.WebControls.WebControl(System.Web. UI.HtmlTextWriterTag.Unknown).Style;
>> tempstyle.Clear();
>> tempstyle.Value = cssvalue;
>> this.currstyles = tempstyle;
>> }
>>>
>> protected override void
>>FillStyleAttributes(System.Web.UI.CssStyleCollec tion
>>attributes,System.Web.UI.IUrlResolutionService urlResolver)
>> {
>> base.FillStyleAttributes(attributes, urlResolver);
>> foreach (string currkey in this.currstyles.Keys) { attributes[currkey]
>>= this.currstyles[currkey]; }
>> }
>>}
>>>
>>It took me a while, and some help as well, to figure out how to do this,
>>but I now use this class quite often, it can be quite useful when
>>dynamically determining an attribute that is used in many elements. Good
>>Luck!
>>--
>>Nathan Sokalski
>>
njsokalski@hotmail.com
>>
http://www.nathansokalski.com/
>>>
>>"_Who" <CalWhoNOSPAN@roadrunner.comwrote in message
>>news:ez7%23kMSGJHA.3664@TK2MSFTNGP04.phx.gbl.. .
>>>>I use the code below to change to a style sheet that has:
>>>>
>>>body
>>>>
>>>{
>>>>
>>>>
>>>...
>>>>
>>>>
>>>background-image:url(../images/background brown.gif);
>>>>
>>>>
>>>>
>>>}
>>>>
>>>Rather than:
>>>>
>>>body
>>>>
>>>{
>>>>
>>>...
>>>>
>>>background-color:black;
>>>>
>>>}
>>>>
>>>>
>>>>
>>>>
>>>>
>>>Dim HtmlLinkObj As HtmlLink = New HtmlLink()
>>>>
>>>HtmlLinkObj.Attributes.Add("href", "StyleSheets/Textured.css")
>>>>
>>>HtmlLinkObj.Attributes.Add("rel", "stylesheet")
>>>>
>>>HtmlLinkObj.Attributes.Add("type", "text/css")
>>>>
>>>HeadMaster.Controls.Add(HtmlLinkObj)
>>>>
>>>>
>>>>
>>>Works OK on IE but has no effect in FireFox nor Safari
>>>>
>>>On the .master there is:
>>>>
>>><head id="HeadMaster"...
>>>>
>>>>
>>>>
>>>I once saw where some one added to the body tag in addition to the head
>>>(I think).
>>>>
>>>Been looking but can't find it now that I'd like to try it.
>>>>
>>>Do you know how to do that?
>>>>
>>>Have any other ideas how to make it work in FireFox and Safari
>>>>
>>>>
>>>>
>>>Thanks
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>