elle0087
elle0087

Reputation: 911

Add elements in master page from the content page

i have a master page like this:

<div style="position: relative;display:flex; left: 30px; top: 20px;height:100%; float: left; width:95%"> 
      <div style="float: left;font-size: 12px;height:100%; width: 90%;">
         <asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">                                         
                        
         </asp:ContentPlaceHolder>
       </div>                
       <div runat="server" id="div_Basket" style="float: right; font-size: 12px;height:100%;min-width:180px;width:180px;">
       </div>
</div>

the page is divided keeping on right a menù. on one content page i would add a element on the right side. how can i do it?

Upvotes: 0

Views: 49

Answers (1)

freefaller
freefaller

Reputation: 19953

Unless I'm missing something, you need to add another <asp:ContentPlaceHolder> within the second <div>...

<div runat="server" id="div_Basket" style="float: right; font-size: 12px;height:100%;min-width:180px;width:180px;">
  <asp:ContentPlaceHolder runat="server" ID="BasketPlaceHolder" />
</div>

Then within the page you wish to add the new element, implement a corresponding <asp:Content> element...

<asp:Content runat="server" ContentPlaceHolderID="BasketPlaceHolder">
  <div id="newElement"></div>
</asp:Content>

The advantage of this is that pages using the masterpage do NOT have to implement the <asp:Content>, so you don't have update them all... only the ones you need.

Upvotes: 1

Related Questions