Styles and Cascading Style Sheets

Discussion in 'ASP .Net' started by JezB, Apr 30, 2004.

  1. JezB

    JezB Guest

    Is it possible to programatically examine and modify a page's Styles
    (including Cascading Style Sheets) within the code-behind-module (eg. c#) ?

    My guess is that since these are HTML elements the answer is no, since these
    will only exist in the browser whereas the code-behind runs on the web
    server, but I wanted verification from you experts out there (I'm new to
    ASP.NET).

    If the answer is no, is it possible via javascript ?

    Thanks in advance.
     
    JezB, Apr 30, 2004
    #1
    1. Advertising

  2. JezB

    avnrao Guest

    for web controls : you can set CSSClass property in code behind.
    as you said for HTML controls - you cant set it in code behind, but you can
    set it in javascript at the client side.

    control.style.className = "stylename";

    Av.

    "JezB" <> wrote in message
    news:...
    > Is it possible to programatically examine and modify a page's Styles
    > (including Cascading Style Sheets) within the code-behind-module (eg. c#)
    > ?
    >
    > My guess is that since these are HTML elements the answer is no, since
    > these
    > will only exist in the browser whereas the code-behind runs on the web
    > server, but I wanted verification from you experts out there (I'm new to
    > ASP.NET).
    >
    > If the answer is no, is it possible via javascript ?
    >
    > Thanks in advance.
    >
    >
     
    avnrao, Apr 30, 2004
    #2
    1. Advertising

  3. JezB

    JezB Guest

    But how can I examine and manipulate what is IN those styles ? eg. the
    FONT-WEIGHT property of a style. Is this by javascript only ?

    "avnrao" <> wrote in message
    news:...
    > for web controls : you can set CSSClass property in code behind.
    > as you said for HTML controls - you cant set it in code behind, but you

    can
    > set it in javascript at the client side.
    >
    > control.style.className = "stylename";
    >
    > Av.
    >
    > "JezB" <> wrote in message
    > news:...
    > > Is it possible to programatically examine and modify a page's Styles
    > > (including Cascading Style Sheets) within the code-behind-module (eg.

    c#)
    > > ?
    > >
    > > My guess is that since these are HTML elements the answer is no, since
    > > these
    > > will only exist in the browser whereas the code-behind runs on the web
    > > server, but I wanted verification from you experts out there (I'm new to
    > > ASP.NET).
    > >
    > > If the answer is no, is it possible via javascript ?
    > >
    > > Thanks in advance.
    > >
    > >

    >
    >
     
    JezB, Apr 30, 2004
    #3
  4. JezB

    avnrao Guest

    generally style sheets are used for putting the styles in one place. if you
    want to programmatically change, its good practice to change only the name
    of the style to some other style that is in the CSS file.
    i am not sure of your requirement. do want to modify for server controls or
    for html controls ?
    Av.


    "JezB" <> wrote in message
    news:...
    > But how can I examine and manipulate what is IN those styles ? eg. the
    > FONT-WEIGHT property of a style. Is this by javascript only ?
    >
    > "avnrao" <> wrote in message
    > news:...
    >> for web controls : you can set CSSClass property in code behind.
    >> as you said for HTML controls - you cant set it in code behind, but you

    > can
    >> set it in javascript at the client side.
    >>
    >> control.style.className = "stylename";
    >>
    >> Av.
    >>
    >> "JezB" <> wrote in message
    >> news:...
    >> > Is it possible to programatically examine and modify a page's Styles
    >> > (including Cascading Style Sheets) within the code-behind-module (eg.

    > c#)
    >> > ?
    >> >
    >> > My guess is that since these are HTML elements the answer is no, since
    >> > these
    >> > will only exist in the browser whereas the code-behind runs on the web
    >> > server, but I wanted verification from you experts out there (I'm new
    >> > to
    >> > ASP.NET).
    >> >
    >> > If the answer is no, is it possible via javascript ?
    >> >
    >> > Thanks in advance.
    >> >
    >> >

    >>
    >>

    >
    >
     
    avnrao, Apr 30, 2004
    #4
  5. JezB

    coollzh Guest

    you can user HTML Control runing at server
    then you can the style of the element

    "JezB" <> дÈëÏûÏ¢
    news:...
    > Is it possible to programatically examine and modify a page's Styles
    > (including Cascading Style Sheets) within the code-behind-module (eg. c#)

    ?
    >
    > My guess is that since these are HTML elements the answer is no, since

    these
    > will only exist in the browser whereas the code-behind runs on the web
    > server, but I wanted verification from you experts out there (I'm new to
    > ASP.NET).
    >
    > If the answer is no, is it possible via javascript ?
    >
    > Thanks in advance.
    >
    >
     
    coollzh, Apr 30, 2004
    #5
  6. JezB

    JezB Guest

    Could you give me a simple example ?

    "coollzh" <> wrote in message
    news:%...
    > you can user HTML Control runing at server
    > then you can the style of the element
    >
    > "JezB" <> дÈëÏûÏ¢
    > news:...
    > > Is it possible to programatically examine and modify a page's Styles
    > > (including Cascading Style Sheets) within the code-behind-module (eg.

    c#)
    > ?
    > >
    > > My guess is that since these are HTML elements the answer is no, since

    > these
    > > will only exist in the browser whereas the code-behind runs on the web
    > > server, but I wanted verification from you experts out there (I'm new to
    > > ASP.NET).
    > >
    > > If the answer is no, is it possible via javascript ?
    > >
    > > Thanks in advance.
    > >
    > >

    >
    >
     
    JezB, Apr 30, 2004
    #6
    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. Herb Stull

    Cascading Style Sheets

    Herb Stull, Jan 22, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    382
    Herb Stull
    Jan 22, 2004
  2. =?Utf-8?B?SmltIEhlYXZleQ==?=

    Cascading Style Sheets

    =?Utf-8?B?SmltIEhlYXZleQ==?=, Jun 6, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    386
    Cowboy \(Gregory A. Beamer\) [MVP]
    Jun 7, 2004
  3. John
    Replies:
    2
    Views:
    489
    nicholas
    Dec 16, 2004
  4. Fred Nelson
    Replies:
    1
    Views:
    2,716
    =?Utf-8?B?bGF0aGEgdmFsbGluYXlhZ2Ft?=
    May 5, 2005
  5. Todd Cary

    Re: Cascading style sheets

    Todd Cary, Dec 5, 2003, in forum: HTML
    Replies:
    0
    Views:
    408
    Todd Cary
    Dec 5, 2003
Loading...

Share This Page