body.style?

Discussion in 'ASP .Net' started by Progman, Mar 4, 2006.

  1. Progman

    Progman Guest

    <body id="body"
    style="background-image:url(../../Pictures/System/CountryMosaic.JPG)">

    how do i get/set body.style from asp.net?
     
    Progman, Mar 4, 2006
    #1
    1. Advertising

  2. Progman

    Terry Burns Guest

    '//You need to set the Runat attribute to server and give it an ID.
    <body id="body" runat=server style="MARGIN-LEFT: 20px" vLink="#0000ff">

    '//Declare the variable In the designer section
    Protected body As System.Web.UI.HtmlControls.HtmlGenericControl

    '//In your page load event ( or wherever ) use it
    Response.Write(body.Attributes("style").ToString)

    --
    Terry Burns
    http://TrainingOn.net



    "Progman" <> wrote in message
    news:l7lOf.29447$W%...
    > <body id="body"
    > style="background-image:url(../../Pictures/System/CountryMosaic.JPG)">
    >
    > how do i get/set body.style from asp.net?
    >
     
    Terry Burns, Mar 4, 2006
    #2
    1. Advertising

  3. Progman

    Progman Guest

    I tried thi`s:
    <body id="body" runat="server"

    then you will be able to this
    body.style = "background-Image...."

    but the compiler says, style is read-only

    shit...


    "Progman" <> wrote in message
    news:l7lOf.29447$W%...
    > <body id="body"
    > style="background-image:url(../../Pictures/System/CountryMosaic.JPG)">
    >
    > how do i get/set body.style from asp.net?
    >
     
    Progman, Mar 4, 2006
    #3
  4. Progman

    Progman Guest

    i need to set the style attribute.
    will this do it?

    "Terry Burns" <> wrote in message
    news:...
    > '//You need to set the Runat attribute to server and give it an ID.
    > <body id="body" runat=server style="MARGIN-LEFT: 20px" vLink="#0000ff">
    >
    > '//Declare the variable In the designer section
    > Protected body As System.Web.UI.HtmlControls.HtmlGenericControl
    >
    > '//In your page load event ( or wherever ) use it
    > Response.Write(body.Attributes("style").ToString)
    >
    > --
    > Terry Burns
    > http://TrainingOn.net
    >
    >
    >
    > "Progman" <> wrote in message
    > news:l7lOf.29447$W%...
    >> <body id="body"
    >> style="background-image:url(../../Pictures/System/CountryMosaic.JPG)">
    >>
    >> how do i get/set body.style from asp.net?
    >>

    >
    >
     
    Progman, Mar 4, 2006
    #4
  5. Progman

    Progman Guest

    ok found it
    <body id="body1" runat="server" >

    Me.body1.Attributes("style") =
    "background-image:url(../../Pictures/System/CountryMosaic.JPG)"

    "Progman" <> wrote in message
    news:a3mOf.29592$W%...
    >i need to set the style attribute.
    > will this do it?
    >
    > "Terry Burns" <> wrote in message
    > news:...
    >> '//You need to set the Runat attribute to server and give it an ID.
    >> <body id="body" runat=server style="MARGIN-LEFT: 20px" vLink="#0000ff">
    >>
    >> '//Declare the variable In the designer section
    >> Protected body As System.Web.UI.HtmlControls.HtmlGenericControl
    >>
    >> '//In your page load event ( or wherever ) use it
    >> Response.Write(body.Attributes("style").ToString)
    >>
    >> --
    >> Terry Burns
    >> http://TrainingOn.net
    >>
    >>
    >>
    >> "Progman" <> wrote in message
    >> news:l7lOf.29447$W%...
    >>> <body id="body"
    >>> style="background-image:url(../../Pictures/System/CountryMosaic.JPG)">
    >>>
    >>> how do i get/set body.style from asp.net?
    >>>

    >>
    >>

    >
    >
     
    Progman, Mar 4, 2006
    #5
  6. Progman

    Terry Burns Guest

    Style is readonly, but you can set this using the attibutes collection

    Control.Attributes.Item("style") = " your style attributes "
    --
    Terry Burns
    http://TrainingOn.net




    "Progman" <> wrote in message
    news:7KlOf.29586$W%...
    >I tried thi`s:
    > <body id="body" runat="server"
    >
    > then you will be able to this
    > body.style = "background-Image...."
    >
    > but the compiler says, style is read-only
    >
    > shit...
    >
    >
    > "Progman" <> wrote in message
    > news:l7lOf.29447$W%...
    >> <body id="body"
    >> style="background-image:url(../../Pictures/System/CountryMosaic.JPG)">
    >>
    >> how do i get/set body.style from asp.net?
    >>

    >
    >
     
    Terry Burns, Mar 4, 2006
    #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. Frank

    fontclass in body style

    Frank, Oct 6, 2003, in forum: HTML
    Replies:
    3
    Views:
    527
    Steve Pugh
    Oct 6, 2003
  2. Joshua Beall
    Replies:
    14
    Views:
    13,505
    C A Upsdell
    Oct 30, 2003
  3. Ken Varn
    Replies:
    0
    Views:
    479
    Ken Varn
    Apr 26, 2004
  4. London Boy
    Replies:
    2
    Views:
    341
    Keith Bowes
    Jan 12, 2004
  5. Replies:
    5
    Views:
    214
    A. Sinan Unur
    Sep 8, 2005
Loading...

Share This Page