473,698 Members | 2,234 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Change BgColor of aspx page in code

How do I programatically change the background color of an aspx page in
code?

Is there something like Page.BgColor = "#FFFFFF" ?

For that matter, how do I access any of the DOCUMENT properties in code?

I am using Visual Studio 2003, building an ASP.NET web application using
VB.NET.

Thanks,,,,, Cliff
Nov 20 '05 #1
3 2866
* "Cliff Cavin" <Cl********@hot mail.com> scripsit:
How do I programatically change the background color of an aspx page in
code?

Is there something like Page.BgColor = "#FFFFFF" ?


ASP.NET group:

<news://msnews.microsof t.com/microsoft.publi c.dotnet.framew ork.aspnet>

Web interface:

<http://msdn.microsoft. com/newsgroups/default.asp?url =/newsgroups/loadframes.asp? icp=msdn&slcid= us&newsgroup=mi crosoft.public. dotnet.framewor k.aspnet>

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #2
Hi Cliff

Thanks for using Microsoft MSDN Managed Newsgroup. My name is Peter, and I
will be assisting you on this issue.

First of all, I would like to confirm my understanding of your issue.
From your description, I understand that you wants to modify the BgColor of
the Webform and wants to modify other similar document property.
Have I fully understood you? If there is anything I misunderstood, please
feel free to let me know.

I think in Server-Side, i.e. code behind, if you wants to access the
BgColor, you may need to add attribute to the Body which is a
HtmlGenericCont rol control.

Here is a demo, you may have a try and let me know the result.
[ASPX]
<%@ Page language="c#" Codebehind="Web Form1.aspx.cs"
AutoEventWireup ="false" Inherits="TestA sp.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm1 </title>
<meta name="GENERATOR " Content="Micros oft Visual Studio .NET 7.1">
<meta name="CODE_LANG UAGE" Content="C#">
<meta name="vs_defaul tClientScript" content="JavaSc ript">
<meta name="vs_target Schema"
content="http://schemas.microso ft.com/intellisense/ie5">
</HEAD>
<body MS_POSITIONING= "GridLayout " runat="server" id="bg">
<form id="Form1" method="post" runat="server">
<FONT face="Arial"></FONT>
</form>
</body>
</HTML>

[NOTE}
Set the body id to bg so that it can be used in code behind.

[CODEBEHIND]

Protected bg As System.Web.UI.H tmlControls.Htm lGenericControl
Private Sub Page_Load(sende r As Object, e As System.EventArg s)
bg.Attributes.A dd("BgColor", "#ff9933")
End Sub

For other properties, you may try the similar methods.

If you have any concern on this issue, please post here.

Regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! www.microsoft.c om/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 20 '05 #3
Cor
Hi Cliff,

As an alternative to the method from Peter,

You can do in the designer on the page a right click and than choose "Build
Style"
Than you can direct choose the background color of your Page.

I have to admit, the methode from Peter reaches more your question, but I
thought it was good to make you attent on this more in VS.studio.net 2003
build in standard webapproach method.

Cor
How do I programatically change the background color of an aspx page in
code?
Is there something like Page.BgColor = "#FFFFFF" ?
For that matter, how do I access any of the DOCUMENT properties in code?
I am using Visual Studio 2003, building an ASP.NET web application using
VB.NET.

Nov 20 '05 #4

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

Similar topics

2
5301
by: RWD | last post by:
I am trying to figure out how to change the target frame in my hyperlink on a DHTML menu. The menu is in one frame and the target frame is called "main" The code is below: Thanks in advance RWD <script type='text/javascript'>
2
3206
by: cs168 | last post by:
Hi I am new in ASP programming so I do use the very basic and simple way to do all my stuff. Now I do really got stuck at how can I loop thru the calculation for all my selection.. My full code is as below:- <% tBegin = request("beginww") tEnd = request("endww") tYear = request("wwyear") %> <body>
0
1699
by: The Coolest Dolphin | last post by:
OnMouseOver & OnMouseOut event on tablerow to change backcolor of row Hi everyone, I'm looking for a way to use a mouseover/mouseout event (normally done via javascript) via Visual Studio.Net. In the past I succeeded doing this via:
7
2753
by: Cliff Cavin | last post by:
How do I programatically change the background color of an aspx page in code? Is there something like Page.BgColor = "#FFFFFF" ? For that matter, how do I access any of the DOCUMENT properties in code? I am using Visual Studio 2003, building an ASP.NET web application using VB.NET.
1
1368
by: Mirco | last post by:
I must make a aspx page that make these single steps: 1. when I open it is green 2. when I click a button it is blue 3. when I click the same button it is red alternate 2 and 3 I have written this code but it does not work. Which thing I am mistaking?
1
1182
by: Dmitry N.Ananyev | last post by:
Hello friends! I am start my first ASP practic in VS2005. **** My table ****************************** <table> <tr> <td></td> </tr> <tr>
6
3725
by: acord | last post by:
Hi, I want to change the background color of a ul/li row, but the following code is not working as I expected. It works in <table><tr>... <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
1
1362
by: =?Utf-8?B?cm9kY2hhcg==?= | last post by:
hey all, is there an easy way to change the background color of the page in the code-behind? thanks, rodchar
1
7424
by: roshina | last post by:
Hi Iam facing a problem in my project, developing a web site for online shopping in ASP on windows XP using IIS server. All the validations are ok but the new password is not upadated in the data base and also showing a error page. the operating system we used is Windows XP, the source code is ASP, front end we used - HTML and javascript and vb script for validations. the inputs we used are : old pasword :
1
2066
by: nsteiner | last post by:
Hi all On my web page I have a 3 column table. The first cell changes background color when mouseover event occurs. Something like this : <TR><TD onMouseOver="this.bgColor='#00CC00'" onMouseOut="this.bgColor='#F0FFF0'" >name</TD> <TD>number</TD> <TD>address</TD><TR> This works fine.
0
8674
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
8604
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
9028
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
8895
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
8861
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7728
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...
0
4369
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
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2001
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.