473,811 Members | 2,859 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Two ContentPlaceHol ders in the MasterPage

Hi,

Are there a way to show both ContentPlaceHol ser's at the same time ??
The following code show two ContentPlaceHol ders, 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:1 00px;">
Some text
</div>
<div style="position : relative; left: 250px; top: 150px; width:
400px; border-style: dotted;
border-color: Blue;">
<asp:ContentPla ceHolder ID="ContentPlac eHolder1" runat="server">
</asp:ContentPlac eHolder>
</div>
<div style="position : fixed; left: 50px; top: 50px; width: 400px;
border-style: dotted;
border-color: Blue;">
<asp:ContentPla ceHolder ID="ContentPlac eHolder2" runat="server">
</asp:ContentPlac eHolder>
</div>
<div>
Some more text
</div>
</form>
</body>

Thank you in advance.

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

Are there a way to show both ContentPlaceHol ser's at the same time ??
The following code show two ContentPlaceHol ders, 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:1 00px;">
* * * * Some text
* * </div>
* * * * <div style="position : relative; left: 250px; top: 150px; width:
400px; border-style: dotted;
* * * * * * border-color: Blue;">
* * * * * * <asp:ContentPla ceHolder ID="ContentPlac eHolder1" runat="server">
* * * * * * </asp:ContentPlac eHolder>
* * * * </div>
* * * * <div style="position : fixed; left: 50px; top: 50px; width: 400px;
border-style: dotted;
* * * * * * border-color: Blue;">
* * * * * * <asp:ContentPla ceHolder ID="ContentPlac eHolder2" runat="server">
* * * * * * </asp:ContentPlac eHolder>
* * * * </div>
* * <div>
* * * * Some more text
* * </div>
* * </form>
</body>

Thank you in advance.

BR
Peter
Hi Peter

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

* If a ContentPlaceHol der is declared on the content page, it must
have a ContentPlaceHol derID 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 ContentPlaceHol der on the content
page will be rendered in the normal way. If the corresponding
ContentPlacehol der on the master page has anything in it, then that is
overwritten by the content page version (including empty content).

* If a ContentPaceHold er declared on the master page has no matching
ContentPlaceHol der on the content page, then any content that exists
within that ContenPlaceHold er 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 ContentPlaceHol der'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********@phi lhall.netwrote in message
news:b3******** *************** ***********@s20 g2000prd.google groups.com...
On 26 Aug, 13:32, "Peter Larsen [CPH]" <PeterLar...@co mmunity.nospam>
wrote:

* If a ContentPlaceHol der is declared on the content page, it must
have a ContentPlaceHol derID 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 ContentPlaceHol der on the content
page will be rendered in the normal way. If the corresponding
ContentPlacehol der on the master page has anything in it, then that is
overwritten by the content page version (including empty content).

* If a ContentPaceHold er declared on the master page has no matching
ContentPlaceHol der on the content page, then any content that exists
within that ContenPlaceHold er 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.mas ter):

<body>
<form id="form1" runat="server">
<div>
This is:
<asp:contentpla ceholder id="ContentPlac eHolder1" runat="server">
</asp:contentplac eholder>
<br />
And This is:
<asp:ContentPla ceHolder ID="ContentPlac eHolder2" runat="server">
</asp:ContentPlac eHolder>
</div>
</form>
</body>

Default.aspx page:

<asp:Content ID="Content1" ContentPlaceHol derID="ContentP laceHolder1"
Runat="Server">
ContentPlaceHol der1
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHol derID="ContentP laceHolder2"
Runat="Server">
ContentPlaceHol der2
</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****@microsof t.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 (ContentPalaceH olders) 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.comwr ote in message
news:b0******** ******@TK2MSFTN GHUB02.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...@co mmunity.nospam>
wrote:
Hi Jialiang,

So what you say is that the content (ContentPalaceH olders) 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.comwr ote in messagenews:b0* *************@T K2MSFTNGHUB02.p hx.gbl...
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
1744
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 between them it don't work, if the default masterpage is "onepanel.master" and try to change it in runtime, ContentPanel2 which is exist in the loaded masterpage throw exception.. the same happen if the default is "twopanel.master" and switch it...
4
1377
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 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,
1
1215
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 ContentPlaceHolder2. <%@ Master Language="VB" CodeFile="Master.master.vb" Inherits="Master" %> <asp:ContentPlaceHolder ID="ContentPlaceHolder2" runat="server">
0
1139
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 extensively and are currently researching on refactoring the project (WAP) to use Master Pages. One challenge is the fact that since MasterPages are integrated with content pages in the Init() stage, all of our references to User
0
9722
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9603
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10644
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10393
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6882
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5550
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5690
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4334
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3015
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.