MasterPage

A

Amilkar Calles

Does anybody knows if exist any way to use a master page without
the "ContentPlaceHolderID" in the content page? (the default.aspx or
services.aspx for example)

What I want to do is load this aspx with the masterpage specified in the
webconfig

Thanks!
 
S

Stan

Does anybody knows if exist any way to use a master page without
the "ContentPlaceHolderID" in the content page? (the default.aspx or
services.aspx for example)

What I want to do is load this aspx with the masterpage specified in the
webconfig

Thanks!

The MasterPage is specified in the @page directive of the content
pages not in web.config.

If you want to present the MasterPage as a viewable page on its own
then just leave the content placeholders empty in a designated content
page. Nothing is rendered in the content placeholder locations if they
are blank even though they appear in design view.
 
S

Seth Williams

You can specifiy the Master page in the Web.config file with no problem
However, there is no way to get the page loaded without the
ContentPlaceholder
That's where the content of the individual pages is placed. Without the
ContentPlaceholder in each page, there is no content on each page.


David Wier
http://aspnet101.com
http://iWritePro.com - One click PDF, convert .doc/.rtf/.txt to HTML with no
bloated markup
 
S

Stan

Dear Seth, Amilkar

You can specifiy the Master page in the Web.config file with no problem
However, there is no way to get the page loaded without the
ContentPlaceholder
That's where the content of the individual pages is placed. Without the
ContentPlaceholder in each page, there is no content on each page.

Thank you Seth for pointing out my mistake about the option to specify
the master page file in web.config (it can be included as an attribute
in the <pages> tag). It may be a lack of experience (or imagination)
on my part but I cannot see any advantage in doing it that way and VS
2005 designer doesn't seem to support it.

It isn't quite true however that Content pages must have content place
holders in order for the page to be rendered. The rules are a bit more
complex than that and with good reason.

Master pages must have at least one content placeholder. That makes
sense otherwise it might as well be an ordinary page.

Content placeholders in Master pages can be non-empty. Anything placed
in them acts as default content for dependent pages.

Content placeholders in Content pages are optional. When they are
absent they are replaced with default content from the Master page. If
they are present then they overwrite any default content from the
Master page (which means that all default content is removed even if
the local placeholder is empty).

What this adds up to is that, conceivably, a Content page can have no
placeholders and will render the Master page with default content
only. It makes no sense however to have more than one Content page
like this.
 

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
474,262
Messages
2,571,048
Members
48,769
Latest member
Clifft

Latest Threads

Top