Nested Master and contentplaceholders

R

rshillington

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
 
C

clintonG

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/
 
R

rshillington

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
 
C

clintonG

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
 
A

Alan Silver

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top