Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Read From CSS

Reply
Thread Tools

Read From CSS

 
 
Jeronimo Bertran
Guest
Posts: n/a
 
      04-21-2007
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
 
Reply With Quote
 
 
 
 
=?ISO-8859-1?Q?G=F6ran_Andersson?=
Guest
Posts: n/a
 
      04-21-2007
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
 
Reply With Quote
 
 
 
 
daniel #
Guest
Posts: n/a
 
      04-22-2007
Do you need to do it?
Maybe themes could help you.

daniel#

"Jeronimo Bertran" <(E-Mail Removed)> 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



 
Reply With Quote
 
=?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=
Guest
Posts: n/a
 
      04-22-2007
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
>

 
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
CSS Layout question - how to duplicate a table layout with CSS Eric ASP .Net 4 12-24-2004 04:54 PM
confused - html validates, css validates but validate css from the html causes errors Titus A Ducksass - AKA broken-record HTML 6 11-15-2004 12:59 PM
Set CSS property equal to another CSS property? Noozer HTML 10 10-13-2004 09:20 PM
Is there a way to set the a CSS property to be explicitly the same as another CSS property? Joshua Beall HTML 1 12-10-2003 07:21 PM
print.css and screen.css tom watson HTML 1 09-09-2003 02:48 PM



Advertisments