473,387 Members | 1,295 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 2854
* "Cliff Cavin" <Cl********@hotmail.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.microsoft.com/microsoft.public.dotnet.framework.aspnet>

Web interface:

<http://msdn.microsoft.com/newsgroups/default.asp?url=/newsgroups/loadframes.asp?icp=msdn&slcid=us&newsgroup=microso ft.public.dotnet.framework.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
HtmlGenericControl control.

Here is a demo, you may have a try and let me know the result.
[ASPX]
<%@ Page language="c#" Codebehind="WebForm1.aspx.cs"
AutoEventWireup="false" Inherits="TestAsp.WebForm1" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
<HEAD>
<title>WebForm1</title>
<meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
<meta name="CODE_LANGUAGE" Content="C#">
<meta name="vs_defaultClientScript" content="JavaScript">
<meta name="vs_targetSchema"
content="http://schemas.microsoft.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.HtmlControls.HtmlGenericControl
Private Sub Page_Load(sender As Object, e As System.EventArgs)
bg.Attributes.Add("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.com/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
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...
2
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...
0
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...
7
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...
1
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...
1
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
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...
1
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
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...
1
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'"...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.