MasterPages with several ContentPlaceHolder

0

Good morning.

The content place and the master page will be used. Even already be in a dynamic way, changing with several links.

The problem is that I do not know how to get several different Content Pages loaded at the same MasterPage at the same time. I have a MasterPage divided by 3 ContentPlaceHolders :

cphPrincipal (home page) cphMetodologia (information on the company's method) cphPortafolio (company's products)

And I want to load the following pages in these PlaceHolders simultaneously:

  

cphPrincipal - > Principal.aspx
  cphMethodology - > Metodologia.aspx
  cphPortafolio - > Portafolio.aspx

The detail is that when I call one of the pages (for example principal.aspx so that it is loaded in the cphcontent) the other ContentPlaceHolders go blank and do not load anything.

Is there any way to tell the ContentPlaceHolder of the MasterPage to load the default page?

I already tried with this code: MasterPage

<!-- contenido -->
<asp:ContentPlaceHolder ID="cphPrincipal" runat="server </asp:ContentPlaceHolder>
<asp:ContentPlaceHolder ID="cphMetodologia " runat="server </asp:ContentPlaceHolder>
<asp:ContentPlaceHolder ID="cphPortafolio " runat="server </asp:ContentPlaceHolder>
<!-- //contenido -->

Two aspx example:

principal.aspx

<%@ Page Title="" Language="C#"
 MasterPageFile="~/MasterPage/mpWeb.Master" AutoEventWireup="true"
 CodeBehind="Principal.aspx.cs" Inherits="GUI.Principal" %>  
 asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>  
<asp:Content ID="Content2" 
ContentPlaceHolderID="cphPrincipal" runat="server"> </asp:Content>

metodologia.aspx

<%@ Page Title="" Language="C#"
 MasterPageFile="~/MasterPage/mpWeb.Master" AutoEventWireup="true"
 CodeBehind="Metodologia.aspx.cs" Inherits="GUI.Metodologia" %>  
< asp:Content ID="Content3" ContentPlaceHolderID="cphMetodologia"
 runat="server">

portafolio.aspx

<%@ Page Title="" Language="C#"
 MasterPageFile="~/MasterPage/mpWeb.Master"
 AutoEventWireup="true" CodeBehind="Portafolio.aspx.cs"
 Inherits="GUI.Portafolio" %>  
< asp:Content ID="Content4" ContentPlaceHolderID="cphPortafolio" runat="server">

But only charge the first, and the others do not charge.

Thank you very much in advance.

    
asked by Emmanuel Manzanilla González 14.07.2016 в 17:49
source

2 answers

0

It does not work that way, the master defines a template that you apply to a single aspx.

I would recommend read

Overview of ASP.NET homepages

to understand the concept.

What you want to implement could only be achieved using the iframe or frameset

HTML frameset Tag

in each frame if you can assign a different page

> > > > > > I want to pass the full page with a dynamic height (the page is long), and I managed to make the width dynamic using boostrap, but I can not do it with the height, since it always shows the scroll

To adapt the higth you will have to adapt the dimensions using jquery to be able to change the value dynamically according to the content that is loaded

How to change height of iframe based on dynamic conent within the iframe?

Make iframe automatically adjust height according to the contents without using scrollbar?

    
answered by 14.07.2016 / 19:35
source
0

Each of the pages (principal.aspx, portafolio.aspx, metodlogía.aspx runs independently between them, but each one has access to the master template and is responsible for assigning its content. one makes use of only one ContentPlaceHolder , and does not assign that of the others.

You can review this solution if you want to upload the content from other pages, for example creating one called start.aspx, that follows the solution of the link filling the 3 elements or putting that code in the MasterPage.

Anyway, it is possible that your conceptualization is not completely correct, so I suggest you check well if you really want to do that, which I do not think is entirely correct.

Greetings.

    
answered by 14.07.2016 в 20:31