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

Two ContentPlaceHolders in the MasterPage

Hi,

Are there a way to show both ContentPlaceHolser's at the same time ??
The following code show two ContentPlaceHolders, but i don't know what to do
to make them both visible at the same time.

<body>
<form id="form2" runat="server">
<div style="height:100px;">
Some text
</div>
<div style="position: relative; left: 250px; top: 150px; width:
400px; border-style: dotted;
border-color: Blue;">
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
<div style="position: fixed; left: 50px; top: 50px; width: 400px;
border-style: dotted;
border-color: Blue;">
<asp:ContentPlaceHolder ID="ContentPlaceHolder2" runat="server">
</asp:ContentPlaceHolder>
</div>
<div>
Some more text
</div>
</form>
</body>

Thank you in advance.

BR
Peter
Aug 26 '08 #1
6 2114
On 26 Aug, 13:32, "Peter Larsen [CPH]" <PeterLar...@community.nospam>
wrote:
Hi,

Are there a way to show both ContentPlaceHolser's at the same time ??
The following code show two ContentPlaceHolders, but i don't know what todo
to make them both visible at the same time.

<body>
* * <form id="form2" runat="server">
* * <div style="height:100px;">
* * * * Some text
* * </div>
* * * * <div style="position: relative; left: 250px; top: 150px; width:
400px; border-style: dotted;
* * * * * * border-color: Blue;">
* * * * * * <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
* * * * * * </asp:ContentPlaceHolder>
* * * * </div>
* * * * <div style="position: fixed; left: 50px; top: 50px; width: 400px;
border-style: dotted;
* * * * * * border-color: Blue;">
* * * * * * <asp:ContentPlaceHolder ID="ContentPlaceHolder2" runat="server">
* * * * * * </asp:ContentPlaceHolder>
* * * * </div>
* * <div>
* * * * Some more text
* * </div>
* * </form>
</body>

Thank you in advance.

BR
Peter
Hi Peter

You can have as many ContentPlaceHolders as you like and all can be
visible at the same time. The rules are as follows:

* If a ContentPlaceHolder is declared on the content page, it must
have a ContentPlaceHolderID property matching the ID property of one
of those declared in the master page. Otherwise an error is generated.

* Whatever is placed inside a valid ContentPlaceHolder on the content
page will be rendered in the normal way. If the corresponding
ContentPlaceholder on the master page has anything in it, then that is
overwritten by the content page version (including empty content).

* If a ContentPaceHolder declared on the master page has no matching
ContentPlaceHolder on the content page, then any content that exists
within that ContenPlaceHolder on the master page will be rendered on
the content page (i.e. becomes default content). If it is empty then
nothing will be rendered in that location.

Hope that makes sense
Aug 26 '08 #2
Hi Stan,

Thanks for your input.

Yes it does make sense.
What you write is pretty much the same i have found. The problem is that i
don't see the content from the two ContentPlaceHolder's at the same time..
I have the following files:
Site.master
Default1.aspx
Default2.asps

If i select Default1.aspx and run the project, the content contained in
Default1 is shown and Default2.aspx is not shown. If i select Default2 and
run, the Default2 is shown and Default1 is hided.
I do see the div border read from the master file for both sections, its
just the content that is missing.

From what you say, both files should be visible, but that's not what i see
(?) !!
What am i doing wrong here ??

BR
Peter
"Stan" <go********@philhall.netwrote in message
news:b3**********************************@s20g2000 prd.googlegroups.com...
On 26 Aug, 13:32, "Peter Larsen [CPH]" <PeterLar...@community.nospam>
wrote:

* If a ContentPlaceHolder is declared on the content page, it must
have a ContentPlaceHolderID property matching the ID property of one
of those declared in the master page. Otherwise an error is generated.

* Whatever is placed inside a valid ContentPlaceHolder on the content
page will be rendered in the normal way. If the corresponding
ContentPlaceholder on the master page has anything in it, then that is
overwritten by the content page version (including empty content).

* If a ContentPaceHolder declared on the master page has no matching
ContentPlaceHolder on the content page, then any content that exists
within that ContenPlaceHolder on the master page will be rendered on
the content page (i.e. becomes default content). If it is empty then
nothing will be rendered in that location.

Hope that makes sense
Aug 27 '08 #3
Hello Peter,

Stan meant to put the two content place holders in one aspx page. For
example:

Master page (MasterPage.master):

<body>
<form id="form1" runat="server">
<div>
This is:
<asp:contentplaceholder id="ContentPlaceHolder1" runat="server">
</asp:contentplaceholder>
<br />
And This is:
<asp:ContentPlaceHolder ID="ContentPlaceHolder2" runat="server">
</asp:ContentPlaceHolder>
</div>
</form>
</body>

Default.aspx page:

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
ContentPlaceHolder1
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2"
Runat="Server">
ContentPlaceHolder2
</asp:Content>

Please try it again and let us know whether it helps you.

Regards,
Jialiang Ge (ji****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subs...#notifications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/...tance&ln=en-us.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Aug 27 '08 #4
Hi Jialiang,

So what you say is that the content (ContentPalaceHolders) must come from
the same aspx file ??
I choose the aspx file to show - and thats what it does.

/Peter
""Jialiang Ge [MSFT]"" <ji****@online.microsoft.comwrote in message
news:b0**************@TK2MSFTNGHUB02.phx.gbl...
Hello Peter,

Stan meant to put the two content place holders in one aspx page. For
example:

Sep 1 '08 #5
On 1 Sep, 08:44, "Peter Larsen [CPH]" <PeterLar...@community.nospam>
wrote:
Hi Jialiang,

So what you say is that the content (ContentPalaceHolders) must come from
the same aspx file ??
I choose the aspx file to show - and thats what it does.

/Peter

""Jialiang Ge [MSFT]"" <jia...@online.microsoft.comwrote in messagenews:b0**************@TK2MSFTNGHUB02.phx.gb l...
Hello Peter,
Stan meant to put the two content place holders in one aspx page. For
example:
Hi Peter

Sorry for the delay in responding.

I'm not so sure now about what you are really asking.

If a client requests Default1.aspx then it will receive the result of
merging Site.master with Default1.aspx, according to the rules I
outlined previously. The content of Default2.aspx is not involved and
has no bearing on the result. Only the master and the requested
content page are used to service the request.
Sep 4 '08 #6
Hi Stan,

Thanks for your comment - i understand now how it works.

/Peter
Sep 6 '08 #7

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

Similar topics

5
by: Islamegy® | last post by:
In my project i have two master page which i change dynamic in runtime.. The first one with 1 ContentPanel "onepanel.master", the second with 2 contentPanel"twopanel.master".. but when i switch...
4
by: rshillington | last post by:
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...
1
by: Brad Isaacs | last post by:
Good evening friends, Working with Visual Studio 2005, VB and ASP.NET 2.0 My website project contains a MasterPage.master that contains a Menu control placed inside a table located inside...
0
by: jgdean14 | last post by:
Hi - We have an Early .NET 2.0 App that was created without Master Pages about a year ago. We opted for more of a MVC framework and dynamically- loaded User Controls. We use Custom User-Controls...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.