473,749 Members | 2,580 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Changing Page Background Color

I need to be able to change the background color of an ASP.NET page on the
fly, in code. I see a bgcolor property on the Document and if I change that
it does the job nicely, but I cannot find a way to change this in code...
say in the Page_Load event.

Any help is much appreciated.

Thanks, Herb
Nov 18 '05 #1
2 2961
set the <BODY...> tag with a runat=server and declare it as a generic html
control.
they programmaticall y set the color from code-behind.

--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com
"Herb Stull" <st*****@nautic om.net> wrote in message
news:40******** **@news.nautico m.net...
I need to be able to change the background color of an ASP.NET page on the
fly, in code. I see a bgcolor property on the Document and if I change that it does the job nicely, but I cannot find a way to change this in code...
say in the Page_Load event.

Any help is much appreciated.

Thanks, Herb

Nov 18 '05 #2
if you put a id="body1" runat="server" in your body tag then to change
the color in your code you would use
body1.attribute s("bgcolor") = "#ff00ff" or whatever color you wanted.

"Herb Stull" <st*****@nautic om.net> wrote in message
news:40******** **@news.nautico m.net...
I need to be able to change the background color of an ASP.NET page on the
fly, in code. I see a bgcolor property on the Document and if I change that it does the job nicely, but I cannot find a way to change this in code...
say in the Page_Load event.

Any help is much appreciated.

Thanks, Herb

Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2489
by: Dj Frenzy | last post by:
Hi, I know how to use javascript to change a background image to another background image, and how to change a background colour to another background colour. Is there a way to change an image to a backgound colour? I have a table with a background that has a picture. When the user hovers over the picture I want the background to change to the background colour of the rest of the page, as if to make the picture disappear.
2
2660
by: Martin | last post by:
Dear Experts! I'd be grateful if you can help me with this. I'm having an inline frame which points to 'www.externalsite.com'. The page which contains the inline frame has an orange background, the pages at 'www.externalsite.com' have a white background. Can I change the background of 'www.externalsite.com' to mach the background of the inline frame page upon loading?
14
3947
by: Don G | last post by:
Within the menu for my site, I have inserted 'class="current"' within the link for the current page. So the link looks somthing link: <li><a href="index.php" class="current">Home</a></li> The css for formatting the menu links is: #menu a:hover { background-color: #E00080; color: white;
1
1753
by: P.Singh | last post by:
hi all i am designing a website for a charity origanisation. they cater towards the senior crowd. i would like to have choice by which the user can change the background as required (like beige/grey/aqua etc.) and also the text color/font and browse the site with that background and text color . will i need to make different copies of the site and link them together.
31
5720
by: Arthur Shapiro | last post by:
I'm the webmaster for a recreational organization. As part of one page of the site, I have an HTML "Calendar at a Glance" of the organization's events for the month. It's a simple table of a calendar, 7 across by whatever needed down, and I manually create it each month - not a big deal. Every day I go in and darken the background color of the current day's cell by changing the appropriate <TD> entry to <TD bgcolor="c63800"> and...
6
56640
by: Nancy Carter | last post by:
I'm trying to set the background color of a frameset to black. The following code doesn't work in either IE 6.0 or Firefox. Any ideas why? <frameset bgcolor="#000000" frameborder="0" border="0" cols="240,*"> <frame name="links" scrolling="no" noresize target="contents" src=""> <frameset bgcolor="#000000" frameborder="0" border="0" rows="135,*"> <frame name="topbanner" scrolling="no" src="">
7
2798
by: VB Programmer | last post by:
I am trying to change some webform's background color based on a value in my web.config file. This is how I am doing it: ' set background color based on web.config setting Dim Body As New HtmlGenericControl Body = CType(Page.Controls(1), HtmlGenericControl) Body.Attributes("bgcolor") = ConfigurationSettings.AppSettings("BackgroundColor")
4
3781
by: Chris Mahoney | last post by:
Hi Currently I am setting the background image of my page by using the following code: <style type="text/css"> BODY { BACKGROUND-IMAGE: url(myimage.jpg) } </style> What I would like to do is change the background image dynamically. My guess
12
4552
by: GaryDean | last post by:
In the original post I failed so indicate that I am using framework 1.1....... I need to be able to change the background color of a page from code. I found an answer to this question in another forum from Peter Huang that said that an id="bg" as follows... <body MS_POSITIONING="GridLayout" runat="server" id="bg"> then we could do the following in our codebehind file....
4
1816
by: gescom | last post by:
I'm sort of locked into a template from this software my company bought, and it's very restrictive. All color schemes and layouts are site wide only, which creates a bit of a hassle for some pages. The one think I'm looking for is how to change a single page's background color. It appears that the site's layout is a table, so I guess the question is how do I change the background color of a cell within a table indirectly. I only have...
0
8997
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8833
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9389
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9335
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8257
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6801
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4709
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4881
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2218
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.