473,325 Members | 2,480 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,325 software developers and data experts.

Change Property on Master Page at runtime?

Howdy,

I have my master page, and I would like to change the background CSS class
per the content page. Only the home page has a different background style,
all other pages are using the same. I know I can create a new master page,
but I'd like to just change the master page from the content page if
possible.

thanks!

--
David Lozzi
dlozzi@(remove)delphi-ts.com
www.delphi-ts.com
Jul 7 '06 #1
4 3125
Hi David,
Every page has a "Master" property. You can use this property to change the
contents of master page.

"David Lozzi" wrote:
Howdy,

I have my master page, and I would like to change the background CSS class
per the content page. Only the home page has a different background style,
all other pages are using the same. I know I can create a new master page,
but I'd like to just change the master page from the content page if
possible.

thanks!

--
David Lozzi
dlozzi@(remove)delphi-ts.com
www.delphi-ts.com
Jul 7 '06 #2
how to I select the class of the body? Also, would it make sense to check it
from the master page instead of per content page? So put this on the master
page

If content.Page.ToString = "ASP.default_aspx" then
use one background
else
use other
end if

just how do i get to the backjground properties or class name of body??

Thanks!!

David Lozzi

"Tushar" <Tu****@discussions.microsoft.comwrote in message
news:39**********************************@microsof t.com...
Hi David,
Every page has a "Master" property. You can use this property to change
the
contents of master page.

"David Lozzi" wrote:
>Howdy,

I have my master page, and I would like to change the background CSS
class
per the content page. Only the home page has a different background
style,
all other pages are using the same. I know I can create a new master
page,
but I'd like to just change the master page from the content page if
possible.

thanks!

--
David Lozzi
dlozzi@(remove)delphi-ts.com
www.delphi-ts.com

Jul 7 '06 #3
To reference properties of the master page from a content page we must type
the master in the content page from which we make the reference...

// in content page
<%@ MasterType VirtualPath="~/Masters/ThreeStackedPanels.master" %>
Then we can use public properties or the FindControl method to reference
properties of a control
// control in Master Page
LinkButton navigation = Master.Page.FindControl("NavigationLinkButton") as
LinkButton;
navigation.CssClass = "SmokeyBlue";
--
<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://www.metromilwaukee.com/clintongallagher/
"David Lozzi" <dl****@nospam.nospamwrote in message
news:eJ**************@TK2MSFTNGP04.phx.gbl...
Howdy,

I have my master page, and I would like to change the background CSS class
per the content page. Only the home page has a different background style,
all other pages are using the same. I know I can create a new master page,
but I'd like to just change the master page from the content page if
possible.

thanks!

--
David Lozzi
dlozzi@(remove)delphi-ts.com
www.delphi-ts.com

Jul 7 '06 #4
got it!
thanks

If cphBody.Page.ToString = "ASP.default_aspx" Then

bdBody.Style("background-image") = "url(site_images/bg_home.gif)"

Else

bdBody.Style("background-image") = "url(site_images/bg_second.gif)"

End If


--
David Lozzi
dlozzi@(remove)delphi-ts.com
www.delphi-ts.com
"David Lozzi" <dl****@nospam.nospamwrote in message
news:ej**************@TK2MSFTNGP03.phx.gbl...
how to I select the class of the body? Also, would it make sense to check
it from the master page instead of per content page? So put this on the
master page

If content.Page.ToString = "ASP.default_aspx" then
use one background
else
use other
end if

just how do i get to the backjground properties or class name of body??

Thanks!!

David Lozzi

"Tushar" <Tu****@discussions.microsoft.comwrote in message
news:39**********************************@microsof t.com...
>Hi David,
Every page has a "Master" property. You can use this property to change
the
contents of master page.

"David Lozzi" wrote:
>>Howdy,

I have my master page, and I would like to change the background CSS
class
per the content page. Only the home page has a different background
style,
all other pages are using the same. I know I can create a new master
page,
but I'd like to just change the master page from the content page if
possible.

thanks!

--
David Lozzi
dlozzi@(remove)delphi-ts.com
www.delphi-ts.com


Jul 7 '06 #5

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

Similar topics

2
by: Rob Roberts | last post by:
In a VS2005 ASP.NET project, I'm trying to find a way to change which css file is linked in based on the browser type. I'd like to use one css file for IE browsers, and a different one for all...
4
by: RedHair | last post by:
I have a base page class A which inherits System.Web.UI.Page class then a aspx page B inherits class A and have a master page C. There is a property D (a string variable) in the master page C. ...
2
by: SR | last post by:
I have started a web site using ASP.NET 2.0. I would like to centralize all of my classes in a StyleSheet but I cannot figure out how to link the StyleSheet to a Content Page since there is no...
4
by: sck10 | last post by:
Hello, I have the following in my Master Page that I am using as a redirect template: <head id="headRedirect" runat="server"> <meta id="metaRedirect" http-equiv="Refresh" content="2;...
1
by: shapper | last post by:
Hello, I am, for almost 2 days, trying to create a nested master page. The objective is: create a NESTED master page at RUNTIME. I looked everywhere and I couldn't find a solution. Basically...
13
by: Kirk | last post by:
I have been reading Scott Allen's article on Master Pages (http:// odetocode.com/Articles/450.aspx) but I am having problems understanding a concept. Specifically, I have created a property...
6
by: =?Utf-8?B?SmF5IFBvbmR5?= | last post by:
I am trying to access a Public property on a Master Page from a Base Page. On the content pages I have the MasterType Directive set up as follows: <%@ MasterType virtualpath="~/Master.master" %>...
4
by: DotNetNewbie | last post by:
Hi, I have a .aspx page that has a master page. In the master page, I have a Literal Control, and I created a public property that allows you to set the liBlah.Text of the literal control. ...
1
by: shapper | last post by:
Hello, I created 2 master pages and a page related as follows: Master1 Master2 MyPage In MyPage I need to access a user control that I added to Master1 to change a few of its properties. ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.