Re: Search for rules in HtmlHead.StyleSheet property
by Steven Cheng[MSFT] on 11/1/2007 7:22:00 AM
Thanks for your reply Andrew,
Yes, the current implementation of the Page.Header.StytleSheet is quite
limited.
If you want to manually manage the page inline stylesheet section, you can
consider the following means:
** manually change the <style> tag to "runat=server"
** use codebehind to manipulate it as a LiteralControl(you can customize
the <style> section like a string variable)
======================
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<style id="mystyle" type="text/css" runat="server">
</style>
</head>
...................
====================
================
protected void Page_Load(object sender, EventArgs e)
{
mystyle.InnerText ="#container{width:90%;}";
.........
}
==================
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
>From: "J055" <j055@newsgroups.nospam>
>References: <#fRI4HjGIHA.4272@TK2MSFTNGP06.phx.gbl>
<jlhuSkqGIHA.4200@TK2MSFTNGHUB02.phx.gbl>
>Subject: Re: Search for rules in HtmlHead.StyleSheet property
>Date: Wed, 31 Oct 2007 17:37:47 -0000
>Hi Steven
>
>The RegisterStyle method doesn't work for me as it only creates a system
>names class selector name. I need to set an ID selector with a width
based
>on the pages currently visible UserControl. What's happening is that it's
>very easy to end up with duplicate entries in the page header style
element,
>e.g.
>
>#container { width:90%; }
>#container { width:600px; }
>
>It would be good if there was a way to check for the #container selector
or
>even better get the styles for the #container too.
>
>I'm thinking that I may need to manage my own way of adding this to the
head
>element. Any suggestions would be appreciated.
>
>Thanks
>Andrew
>
>
Re: Search for rules in HtmlHead.StyleSheet property
by J055 on 11/1/2007 10:13:00 AM
Thanks Steven. Your suggestion probably suites me better.
Cheers
Andrew
"Steven Cheng[MSFT]" <stcheng@online.microsoft.com> wrote in message
news:VnF8cfFHIHA.4268@TK2MSFTNGHUB02.phx.gbl...
> Thanks for your reply Andrew,
>
> Yes, the current implementation of the Page.Header.StytleSheet is quite
> limited.
>
> If you want to manually manage the page inline stylesheet section, you can
> consider the following means:
>
> ** manually change the <style> tag to "runat=server"
>
> ** use codebehind to manipulate it as a LiteralControl(you can customize
> the <style> section like a string variable)
>
> ======================
> <html xmlns="http://www.w3.org/1999/xhtml" >
> <head runat="server">
> <title>Untitled Page</title>
> <style id="mystyle" type="text/css" runat="server">
>
> </style>
> </head>
> ..................
> ====================
>
> ================
> protected void Page_Load(object sender, EventArgs e)
> {
> mystyle.InnerText ="#container{width:90%;}";
> ........
> }
> ==================
>
> Sincerely,
>
> Steven Cheng
>
> Microsoft MSDN Online Support Lead
>
>
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>
>
>
>
>
>
>
>
>
>
>
> --------------------
>>From: "J055" <j055@newsgroups.nospam>
>>References: <#fRI4HjGIHA.4272@TK2MSFTNGP06.phx.gbl>
> <jlhuSkqGIHA.4200@TK2MSFTNGHUB02.phx.gbl>
>>Subject: Re: Search for rules in HtmlHead.StyleSheet property
>>Date: Wed, 31 Oct 2007 17:37:47 -0000
>>Hi Steven
>>
>>The RegisterStyle method doesn't work for me as it only creates a system
>>names class selector name. I need to set an ID selector with a width
> based
>>on the pages currently visible UserControl. What's happening is that it's
>>very easy to end up with duplicate entries in the page header style
> element,
>>e.g.
>>
>>#container { width:90%; }
>>#container { width:600px; }
>>
>>It would be good if there was a way to check for the #container selector
> or
>>even better get the styles for the #container too.
>>
>>I'm thinking that I may need to manage my own way of adding this to the
> head
>>element. Any suggestions would be appreciated.
>>
>>Thanks
>>Andrew
>>
>>
>
Re: Search for rules in HtmlHead.StyleSheet property
by Steven Cheng[MSFT] on 11/2/2007 2:38:00 AM
You're welcome:)
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
--------------------
>From: "J055" <j055@newsgroups.nospam>
>References: <#fRI4HjGIHA.4272@TK2MSFTNGP06.phx.gbl>
<jlhuSkqGIHA.4200@TK2MSFTNGHUB02.phx.gbl>
<u07nHT#GIHA.1324@TK2MSFTNGP06.phx.gbl>
<VnF8cfFHIHA.4268@TK2MSFTNGHUB02.phx.gbl>
>Subject: Re: Search for rules in HtmlHead.StyleSheet property
>Date: Thu, 1 Nov 2007 10:13:05 -0000
>
>Thanks Steven. Your suggestion probably suites me better.
>
>Cheers
>Andrew
>
>
>"Steven Cheng[MSFT]" <stcheng@online.microsoft.com> wrote in message
>news:VnF8cfFHIHA.4268@TK2MSFTNGHUB02.phx.gbl...
>> Thanks for your reply Andrew,
>>
>> Yes, the current implementation of the Page.Header.StytleSheet is quite
>> limited.
>>
>> If you want to manually manage the page inline stylesheet section, you
can
>> consider the following means:
>>
>> ** manually change the <style> tag to "runat=server"
>>
>> ** use codebehind to manipulate it as a LiteralControl(you can customize
>> the <style> section like a string variable)
>>
>> ======================
>> <html xmlns="http://www.w3.org/1999/xhtml" >
>> <head runat="server">
>> <title>Untitled Page</title>
>> <style id="mystyle" type="text/css" runat="server">
>>
>> </style>
>> </head>
>> ..................
>> ====================
>>
>> ================
>> protected void Page_Load(object sender, EventArgs e)
>> {
>> mystyle.InnerText ="#container{width:90%;}";
>> ........
>> }
>> ==================
>>
>> Sincerely,
>>
>> Steven Cheng
>>
>> Microsoft MSDN Online Support Lead
>>
>>
>> This posting is provided "AS IS" with no warranties, and confers no
>> rights.
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> --------------------
>>>From: "J055" <j055@newsgroups.nospam>
>>>References: <#fRI4HjGIHA.4272@TK2MSFTNGP06.phx.gbl>
>> <jlhuSkqGIHA.4200@TK2MSFTNGHUB02.phx.gbl>
>>>Subject: Re: Search for rules in HtmlHead.StyleSheet property
>>>Date: Wed, 31 Oct 2007 17:37:47 -0000
>>>Hi Steven
>>>
>>>The RegisterStyle method doesn't work for me as it only creates a system
>>>names class selector name. I need to set an ID selector with a width
>> based
>>>on the pages currently visible UserControl. What's happening is that it's
>>>very easy to end up with duplicate entries in the page header style
>> element,
>>>e.g.
>>>
>>>#container { width:90%; }
>>>#container { width:600px; }
>>>
>>>It would be good if there was a way to check for the #container selector
>> or
>>>even better get the styles for the #container too.
>>>
>>>I'm thinking that I may need to manage my own way of adding this to the
>> head
>>>element. Any suggestions would be appreciated.
>>>
>>>Thanks
>>>Andrew
>>>
>>>
>>
>
>
>