List Info

Thread: C-Sharp (C#) Group: Problema with MasterPage and ContentPlaceHolder




C-Sharp (C#) Group: Problema with MasterPage and ContentPlaceHolder
user name
2006-03-31 14:01:25
Hello All,

I have a MasterPage and here's the code:


<form id="form1"
runat="server">
<div>
       <asp:contentplaceholder
id="ContentPlaceHolder1"
runat="server">
              <div id="divNeededOnMyProgram"
runat=server></div>
       </asp:contentplaceholder>
</div>
</form>
So, as you can see, I have the div within the
<asp:contentPlaceHolder>
component.  The problem is that when I create a content
page, the code
generated is as follows:

<%


Page Language="VB"
MasterPageFile="~/MasterPage.master"
AutoEventWireup="false"
CodeFile="Default.aspx.vb"
Inherits="_Default"
title="Child Page" %>
<

asp:Content ID="Content1"
ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server">
</asp:Content>
The DIV is gone. I know this is the standard behavior of the
MasterPage. But what I need is that the code within the
<asp:contentPlaceHolder> appear in every and single
Content Page
created based on a particullar MasterPage. How can I extend
my
MasterPage in order to get this behavior?


--
Nakahara Sam

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "C-Sharp (C#)" group.
To post to this group, send email to C_Sharpgooglegroups.com
To unsubscribe from this group, send email to
C_Sharp-unsubscribegooglegroups.com
For more options, visit this group at http://groups.
google.com/group/C_Sharp
-~----------~----~----~----~------~----~------~--~---

C-Sharp (C#) Group: Re: Problema with MasterPage and ContentPlaceHolder
user name
2006-03-31 14:10:13
How about Inheriting a class from ContentPlaceholder and overloading the Controls collection? Just a guess as don't have v2 at work so can't give it a test but if you define a Panel in class scope, add it to base.Controls on Init and override the ContentPlaceholder Controls property to point at the Panel's Controls Collection that may very well do the job you.

Liam

On 3/31/06, Nakahara Sam <gmail.com">nakaharasamgmail.com> wrote:

Hello All,

I have a MasterPage and here's the code:


&lt;form id="form1" runat=&quot;server&quot;>
<;div>
&nbsp; &nbsp;   ; <asp:contentplaceholder id="ContentPlaceHolder1&quot; runat=&quot;server&quot;>
&nbsp; &nbsp;   ; &nbsp; &nbsp; &nbsp; &nbsp;<div id="divNeededOnMyProgram&quot; runat=server></div>
&nbsp; &nbsp; &nbsp;  </asp:contentplaceholder>
</div>;
</form>
So, as you can see, I have the div within the <asp:contentPlaceHolder>
component.&nbsp; The problem is that when I create a content page, the code
generated is as follows:

<%

Page Language=&quot;VB&quot; MasterPageFile="~/MasterPage.master&quot;
AutoEventWireup=&quot;false&quot; CodeFile=&quot; Default.aspx.vb&quot; Inherits=&quot;_Default"
title="Child Page" %>
<

asp:Content ID="Content1&quot; ContentPlaceHolderID="ContentPlaceHolder1"
Runat="Server";>
</asp:Content>
The DIV is gone. I know this is the standard behavior of the
MasterPage. But what I need is that the code within the
<asp:contentPlaceHolder&gt; appear in every and single Content Page
created based on a particullar MasterPage. How can I extend my
MasterPage in order to get this behavior?


--
Nakahara Sam



--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "C-Sharp (C#)" group.
To post to this group, send email to C_Sharpgooglegroups.com
To unsubscribe from this group, send email to C_Sharp-unsubscribegooglegroups.com
For more options, visit this group at http://groups.google.com/group/C_Sharp
-~----------~----~----~----~------~----~------~--~---

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )