Read From CSS

Discussion in 'ASP .Net' started by Jeronimo Bertran, Apr 21, 2007.

  1. 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
     
    Jeronimo Bertran, Apr 21, 2007
    #1
    1. Advertising

  2. 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
     
    =?ISO-8859-1?Q?G=F6ran_Andersson?=, Apr 21, 2007
    #2
    1. Advertising

  3. Jeronimo Bertran

    daniel # Guest

    Do you need to do it?
    Maybe themes could help you.

    daniel#

    "Jeronimo Bertran" <> 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
     
    daniel #, Apr 22, 2007
    #3
  4. 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
    >
     
    =?Utf-8?B?UGV0ZXIgQnJvbWJlcmcgW0MjIE1WUF0=?=, Apr 22, 2007
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Eric
    Replies:
    4
    Views:
    757
    clintonG
    Dec 24, 2004
  2. tom watson

    print.css and screen.css

    tom watson, Sep 9, 2003, in forum: HTML
    Replies:
    1
    Views:
    486
    Jukka K. Korpela
    Sep 9, 2003
  3. Joshua Beall
    Replies:
    1
    Views:
    461
    Bertilo Wennergren
    Dec 10, 2003
  4. Noozer
    Replies:
    10
    Views:
    2,204
    Mitja
    Oct 13, 2004
  5. Titus A Ducksass - AKA broken-record
    Replies:
    6
    Views:
    676
    Titus A Ducksass - AKA broken-record
    Nov 15, 2004
Loading...

Share This Page