change background color

Discussion in 'ASP .Net' started by =?Utf-8?B?cm9kY2hhcg==?=, Mar 2, 2007.

  1. hey all,
    is there an easy way to change the background color of the page in the
    code-behind?

    thanks,
    rodchar
     
    =?Utf-8?B?cm9kY2hhcg==?=, Mar 2, 2007
    #1
    1. Advertising

  2. Hi there,

    -- aspx code --

    <body runat="server" id="myBody">
    html content
    </body>

    -- c# code behind --

    myBody.Attributes["bgcolor"] = "red";
    //or
    myBody.Style.Add(HtmlTextWriterStyle.BackgroundColor, "red");
    // or
    myBody.Style.Add("background-color", "red");

    hope it helps
    --
    --
    Milosz


    "rodchar" wrote:

    > hey all,
    > is there an easy way to change the background color of the page in the
    > code-behind?
    >
    > thanks,
    > rodchar
     
    =?Utf-8?B?TWlsb3N6IFNrYWxlY2tpIFtNQ0FEXQ==?=, Mar 2, 2007
    #2
    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. Ather Ali Shaikh

    How do i change background color to transparent

    Ather Ali Shaikh, Dec 4, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    4,340
    Chris Jackson
    Dec 4, 2003
  2. Craig Duffy

    Can't change textbox background color

    Craig Duffy, Aug 17, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    1,070
    Seanray
    Sep 10, 2004
  3. fig000
    Replies:
    0
    Views:
    4,566
    fig000
    Sep 6, 2004
  4. Kamaljeet Saini
    Replies:
    0
    Views:
    445
    Kamaljeet Saini
    Feb 13, 2009
  5. Replies:
    1
    Views:
    279
    marss
    Feb 14, 2007
Loading...

Share This Page