Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   Read From CSS (http://www.velocityreviews.com/forums/t499217-read-from-css.html)

Jeronimo Bertran 04-21-2007 05:38 PM

Read From CSS
 
I want to be able to programatically read the value from a css stylesheet.
For example, I have a stylesheet with the following style defined:

..dayInactive
{
background-color:#D200D2;
}


And from a C# codebehind I want to be able to obtain the value for the
background-color.

Thanks

Jeronimo Bertran

=?ISO-8859-1?Q?G=F6ran_Andersson?= 04-21-2007 07:07 PM

Re: Read From CSS
 
Jeronimo Bertran wrote:
> I want to be able to programatically read the value from a css stylesheet.
> For example, I have a stylesheet with the following style defined:
>
> .dayInactive
> {
> background-color:#D200D2;
> }
>
>
> And from a C# codebehind I want to be able to obtain the value for the
> background-color.
>
> Thanks
>
> Jeronimo Bertran


There is nothing built in to do this on the server side. To positively
determine the style applied to any given element is rather complicated,
including parsing the page to determine what css files are loaded, load
them and parse them all, and parse the page content to be able to
determine what styles affect the element.

If you just have a simple style like your example, and only want to read
the property from a given css file based on a single class name, you can
just read the file, look for style and extract the property.

--
Göran Andersson
_____
http://www.guffa.com

daniel # 04-22-2007 12:54 AM

Re: Read From CSS
 
Do you need to do it?
Maybe themes could help you.

daniel#

"Jeronimo Bertran" <jeronimo.bertran@newsgroup.nospam> wrote in message
news:Xns99196C3224435publicjbbertrancom@207.46.248 .16...
>I want to be able to programatically read the value from a css stylesheet.
> For example, I have a stylesheet with the following style defined:
>
> .dayInactive
> {
> background-color:#D200D2;
> }
>
>
> And from a C# codebehind I want to be able to obtain the value for the
> background-color.
>
> Thanks
>
> Jeronimo Bertran




=?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?= 04-22-2007 03:08 AM

RE: Read From CSS
 
Jeronimo,
CSS style declarations exist in the browser once they are loaded and are
strictly a client-side ("in the browser") construct, not subsequently
available from server-side code.

Could you be more specific about what exactly is the goal here?
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net




"Jeronimo Bertran" wrote:

> I want to be able to programatically read the value from a css stylesheet.
> For example, I have a stylesheet with the following style defined:
>
> ..dayInactive
> {
> background-color:#D200D2;
> }
>
>
> And from a C# codebehind I want to be able to obtain the value for the
> background-color.
>
> Thanks
>
> Jeronimo Bertran
>



All times are GMT. The time now is 11:48 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.