473,396 Members | 1,992 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,396 software developers and data experts.

Nested Master and contentplaceholders

Consider a site with 3 files the purpose of which I hope is evident in
their names: SiteMaster.master, threeColumnMaster.Master, which uses
SiteMaster.master as its master page and default.aspx which uses
threeColumnMaster.master as it's master page.

The question is can Default.aspx access a ContentPlaceHolder control
defined in SiteMaster.Master. It would seem not, but I just want to
double check.

Thanks in advance,

Ralph Shillington

Jul 17 '06 #1
4 1354
You're using "nested" MasterPages and yes, you can still reference a
ContentPlaceHolder in the top-level Master by passing the value of the
ContentPlaceHolder ID to the FindControl method. Referencing controls when
using MasterPages gets laborious to explain. There are very good blogs that
document MasterPages. One of the better if not the best is at
http://OdeToCode.com.
<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://www.metromilwaukee.com/clintongallagher/

"rshillington" <rs**********@gmail.comwrote in message
news:11*********************@75g2000cwc.googlegrou ps.com...
Consider a site with 3 files the purpose of which I hope is evident in
their names: SiteMaster.master, threeColumnMaster.Master, which uses
SiteMaster.master as its master page and default.aspx which uses
threeColumnMaster.master as it's master page.

The question is can Default.aspx access a ContentPlaceHolder control
defined in SiteMaster.Master. It would seem not, but I just want to
double check.

Thanks in advance,

Ralph Shillington

Jul 18 '06 #2
Clinton,

Thanks for the reply. If I understand you correctly, you're suggesting
the only way to get at ContentPlaceHolders in the hierarchy is through
code. That's a bit unfortunate, but good to know.

Regards,
Ralph Shillington

clintonG wrote:
You're using "nested" MasterPages and yes, you can still reference a
ContentPlaceHolder in the top-level Master by passing the value of the
ContentPlaceHolder ID to the FindControl method. Referencing controls when
using MasterPages gets laborious to explain. There are very good blogs that
document MasterPages. One of the better if not the best is at
http://OdeToCode.com.
<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://www.metromilwaukee.com/clintongallagher/

"rshillington" <rs**********@gmail.comwrote in message
news:11*********************@75g2000cwc.googlegrou ps.com...
Consider a site with 3 files the purpose of which I hope is evident in
their names: SiteMaster.master, threeColumnMaster.Master, which uses
SiteMaster.master as its master page and default.aspx which uses
threeColumnMaster.master as it's master page.

The question is can Default.aspx access a ContentPlaceHolder control
defined in SiteMaster.Master. It would seem not, but I just want to
double check.

Thanks in advance,

Ralph Shillington
Jul 18 '06 #3
Yes, that's exactly what I meant to convey. Enable trace in the content page
and look for controls and you'll see the hierarchy. Read OdeToCode.

<%= Clinton Gallagher

"rshillington" <rs**********@gmail.comwrote in message
news:11**********************@s13g2000cwa.googlegr oups.com...
Clinton,

Thanks for the reply. If I understand you correctly, you're suggesting
the only way to get at ContentPlaceHolders in the hierarchy is through
code. That's a bit unfortunate, but good to know.

Regards,
Ralph Shillington

clintonG wrote:
>You're using "nested" MasterPages and yes, you can still reference a
ContentPlaceHolder in the top-level Master by passing the value of the
ContentPlaceHolder ID to the FindControl method. Referencing controls
when
using MasterPages gets laborious to explain. There are very good blogs
that
document MasterPages. One of the better if not the best is at
http://OdeToCode.com.
<%= Clinton Gallagher
NET csgallagher AT metromilwaukee.com
URL http://www.metromilwaukee.com/clintongallagher/

"rshillington" <rs**********@gmail.comwrote in message
news:11*********************@75g2000cwc.googlegro ups.com...
Consider a site with 3 files the purpose of which I hope is evident in
their names: SiteMaster.master, threeColumnMaster.Master, which uses
SiteMaster.master as its master page and default.aspx which uses
threeColumnMaster.master as it's master page.

The question is can Default.aspx access a ContentPlaceHolder control
defined in SiteMaster.Master. It would seem not, but I just want to
double check.

Thanks in advance,

Ralph Shillington

Jul 18 '06 #4
In article <11*********************@75g2000cwc.googlegroups.c om>,
rshillington <rs**********@gmail.comwrites
>Consider a site with 3 files the purpose of which I hope is evident in
their names: SiteMaster.master, threeColumnMaster.Master, which uses
SiteMaster.master as its master page and default.aspx which uses
threeColumnMaster.master as it's master page.

The question is can Default.aspx access a ContentPlaceHolder control
defined in SiteMaster.Master. It would seem not, but I just want to
double check.
The easiest way is to have a contentplaceholder in the child master that
simply refers to the content control in the main master. That's what I
do and it works fine.

HTH

--
Alan Silver
(anything added below this line is nothing to do with me)
Jul 23 '06 #5

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

Similar topics

1
by: Sasha | last post by:
Hi all asp.net proffesionals out there, How do you implement master pages in your applications? What libraries do you use and what have been your experience? Sasha
3
by: Billy Cormic | last post by:
Hello, I am using Visual Studio 2005 Beta for the first time and am having trouble using contentplaceholders. Actually, I am having trouble declaring them. Here is a snap shot of my master page:...
0
by: Mafuba | last post by:
I'm trying to use data sources with data bound controls on one of my pages that's using a master page. The master page has 2 ContentPlaceHolders, and in my page the data sources are in the first...
4
by: Steve Franks | last post by:
I have this cool nested master page scenario working great. However what is the correct way to be able to access a strongly typed property at the top level master from a content page that has a...
2
by: iturner100 | last post by:
Hi, I've been struggling with this one for a couple of hours without much joy. Basically, I've got a set of nested masterpages (3 as it happens). I'm dynamically generating a new page in code...
17
by: Rob R. Ainscough | last post by:
Again another simple concept that appears NOT to be intuitive or I'm just stupid. I've read the WROX book and the example doesn't actually show how the .master page links in the other content...
7
by: xkeops | last post by:
Thinking of creating a website, most of the pages will have a general toolbar menu, a content and a footer. The content will be the only one who's gonna change but the rest (header,footer) will...
1
by: Paulo | last post by:
Hi, how can I divide a master pages in 4 parts? Header, left menu, right side (main) and footer? Just like a frame... On the header will be the a javscript menu, on left a gridview wich the user...
7
by: Dwight Johnson | last post by:
I am attempting to use Master Pages in a new website, and finding it troublesome. I also do not see a lot of entries in this group regarding them or their components, such as ContentPlaceHolders. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...
0
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...
0
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...

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.