473,387 Members | 1,925 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 background of aspx that uses a MasterPage

Hi!

I have a MasterPage with white background. Within my aspx page I want to
change this color using code behind. How can I achieve this easily?

Thanks

Joe
Aug 3 '07 #1
1 3986
On Aug 3, 8:37 am, Joe Kovac <Joe...@nospam.comwrote:
Hi!

I have a MasterPage with white background. Within my aspx page I want to
change this color using code behind. How can I achieve this easily?
Joe, you can add to the Page_Load method a definition for a new style:

Style s = new Style();
s.BackColor = System.Drawing.Color.Green; // <-- here's your color
Page.Header.StyleSheet.CreateStyleRule(s, this, "BODY");

This will add a CSS rule to your page

BODY { background-color:Green; }

and a color will be changed

Hope this helps
Aug 3 '07 #2

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

Similar topics

3
by: Lakshmi Narayanan.R | last post by:
Hi Experts MasterPage.master In this master page, no <form> tag is used. Register.aspx Here also no <form> tag. But the form elements are working fine inside the <asp:content> tag Is it Ok...
2
by: Steve Franks | last post by:
I am familiar with the fact that you have to use runat=server and links staring with "~/" to ensure proper mapping of paths to relative URLs when using master pages. However this does not seem to...
2
by: jcharles | last post by:
Hi, I'm learning some cool things in the asp.net 2. And when I was using the master page, I created one in the root folder. And created a derived web form in other folder. But when I open this...
9
by: ad | last post by:
Hi, How can I dynamically change the MasterPager of a web page?
7
by: Bon | last post by:
Dear all I create a master page with image buttons on the left-hand side for navigation. When a user clicks the student button, the content (i.e. ContentPlaceholder) in masterpage will be...
7
by: thersitz | last post by:
I can't seem to get my html form to submit properly from within a web form. Here's my form tag syntax and some delivery hidden fields. <form id="myForm"...
7
by: John | last post by:
Hi there, I have a CSS based menu in a master page that uses class attributes to determine which item is currently selected. So, for example if the Homepage is currently the active page then...
4
by: =?Utf-8?B?SmFwZQ==?= | last post by:
Can I refer to the controls on default.aspx from the masterpage? I have a form on the masterpage which sends information that is in a gridview in the default.aspx page.
5
by: Murray | last post by:
Forgive me if this question is too basic, but I'm new to ASP.NET programming, and I can't locate a simple answer to this question. I have a web page that consists of a Master Page and a single...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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,...

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.