DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Fri, 03 Aug 2007 08:37:09 +0200,    posted on: microsoft.public.dotnet.framework.aspnet        back       

Thread Index
  1    Joe Kovac
          2    Alexey Smirnov


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
Date:Fri, 03 Aug 2007 08:37:09 +0200   Author:  

Re: Change background of aspx that uses a MasterPage   
On Aug 3, 8:37 am, Joe Kovac  wrote:

> 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
Date:Fri, 03 Aug 2007 15:13:34 -0700   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us