/
ContentPlaceHolder.xml
131 lines (116 loc) · 9.23 KB
/
ContentPlaceHolder.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
<Type Name="ContentPlaceHolder" FullName="System.Web.UI.WebControls.ContentPlaceHolder">
<TypeSignature Language="C#" Value="public class ContentPlaceHolder : System.Web.UI.Control" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit ContentPlaceHolder extends System.Web.UI.Control implements class System.Web.UI.INamingContainer" />
<TypeSignature Language="DocId" Value="T:System.Web.UI.WebControls.ContentPlaceHolder" />
<TypeSignature Language="VB.NET" Value="Public Class ContentPlaceHolder
Inherits Control" />
<TypeSignature Language="F#" Value="type ContentPlaceHolder = class
 inherit Control
 interface INamingContainer" />
<TypeSignature Language="C++ CLI" Value="public ref class ContentPlaceHolder : System::Web::UI::Control" />
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>System.Web.UI.Control</BaseTypeName>
</Base>
<Interfaces>
<Interface>
<InterfaceName>System.Web.UI.INamingContainer</InterfaceName>
</Interface>
</Interfaces>
<Attributes>
<Attribute FrameworkAlternate="netframework-2.0;netframework-3.0;netframework-3.5">
<AttributeName Language="C#">[System.ComponentModel.Designer("System.Web.UI.Design.WebControls.ContentPlaceHolderDesigner, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]</AttributeName>
<AttributeName Language="F#">[<System.ComponentModel.Designer("System.Web.UI.Design.WebControls.ContentPlaceHolderDesigner, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")>]</AttributeName>
</Attribute>
<Attribute>
<AttributeName Language="C#">[System.ComponentModel.ToolboxItemFilter("System.Web.UI")]</AttributeName>
<AttributeName Language="F#">[<System.ComponentModel.ToolboxItemFilter("System.Web.UI")>]</AttributeName>
</Attribute>
<Attribute>
<AttributeName Language="C#">[System.ComponentModel.ToolboxItemFilter("Microsoft.VisualStudio.Web.WebForms.MasterPageWebFormDesigner", System.ComponentModel.ToolboxItemFilterType.Require)]</AttributeName>
<AttributeName Language="F#">[<System.ComponentModel.ToolboxItemFilter("Microsoft.VisualStudio.Web.WebForms.MasterPageWebFormDesigner", System.ComponentModel.ToolboxItemFilterType.Require)>]</AttributeName>
</Attribute>
<Attribute>
<AttributeName Language="C#">[System.Web.UI.ControlBuilder(typeof(System.Web.UI.WebControls.ContentPlaceHolderBuilder))]</AttributeName>
<AttributeName Language="F#">[<System.Web.UI.ControlBuilder(typeof(System.Web.UI.WebControls.ContentPlaceHolderBuilder))>]</AttributeName>
</Attribute>
<Attribute>
<AttributeName Language="C#">[System.Web.UI.ToolboxData("<{0}:ContentPlaceHolder runat="server"></{0}:ContentPlaceHolder>")]</AttributeName>
<AttributeName Language="F#">[<System.Web.UI.ToolboxData("<{0}:ContentPlaceHolder runat="server"></{0}:ContentPlaceHolder>")>]</AttributeName>
</Attribute>
<Attribute FrameworkAlternate="netframework-4.0;netframework-4.5;netframework-4.5.1;netframework-4.5.2;netframework-4.6;netframework-4.6.1;netframework-4.6.2;netframework-4.7;netframework-4.7.1;netframework-4.7.2;netframework-4.8;netframework-4.8.1">
<AttributeName Language="C#">[System.ComponentModel.Designer("System.Web.UI.Design.WebControls.ContentPlaceHolderDesigner, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")]</AttributeName>
<AttributeName Language="F#">[<System.ComponentModel.Designer("System.Web.UI.Design.WebControls.ContentPlaceHolderDesigner, System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a")>]</AttributeName>
</Attribute>
</Attributes>
<Docs>
<summary>Defines a region for content in an ASP.NET master page.</summary>
<remarks>
<format type="text/markdown"><![CDATA[
## Remarks
A <xref:System.Web.UI.WebControls.ContentPlaceHolder> control defines a relative region for content in a master page, and renders all text, markup, and server controls from a related <xref:System.Web.UI.WebControls.Content> control found in a content page.
A <xref:System.Web.UI.WebControls.Content> control is associated with a <xref:System.Web.UI.WebControls.ContentPlaceHolder> using its <xref:System.Web.UI.WebControls.Content.ContentPlaceHolderID%2A> property. Set the <xref:System.Web.UI.WebControls.Content.ContentPlaceHolderID%2A> property to the value of the <xref:System.Web.UI.Control.ID%2A> property of the related <xref:System.Web.UI.WebControls.ContentPlaceHolder> control in a master page. More than one <xref:System.Web.UI.WebControls.ContentPlaceHolder> can be declared in a master page.
Within a content page, only one <xref:System.Web.UI.WebControls.Content> control can supply the content for a <xref:System.Web.UI.WebControls.ContentPlaceHolder> in the master page. However, in each content page that uses a master page, you can have separate <xref:System.Web.UI.WebControls.Content> controls associated with the <xref:System.Web.UI.WebControls.ContentPlaceHolder>. For example, you can define the <xref:System.Web.UI.WebControls.ContentPlaceHolder> for the page title in a master page. For each content page that uses the master page, you can add a <xref:System.Web.UI.WebControls.Content> control that supplies the text and markup for the page title.
> [!NOTE]
> For XHTML compliance, an empty title element is created if a title has not been defined or cannot be found.
You can specify default content placed within the <xref:System.Web.UI.WebControls.ContentPlaceHolder> control tags, but this content is replaced by any content in an associated content page.
For more information about master pages and content pages, see [DEL: ASP.NET Master Pages](https://msdn.microsoft.com/library/0852291d-6f62-4e9f-a809-45cc81e78d6b).
<a name="DeclarativeSyntax"></a>
## Declarative Syntax
```
<asp: ContentPlaceHolder
EnableViewState="True|False"
ID="string"
OnDataBinding="DataBinding event handler"
OnDisposed="Disposed event handler"
OnInit="Init event handler"
OnLoad="Load event handler"
OnPreRender="PreRender event handler"
OnUnload="Unload event handler"
runat="server"
Visible="True|False"
>
<!-- child controls -->
</asp:ContentPlaceHolder>
```
## Examples
The following code example shows how the <xref:System.Web.UI.WebControls.ContentPlaceHolder> control is used to define a content region for a master page. The first Web page is a master page, and defines a content region using a <xref:System.Web.UI.WebControls.ContentPlaceHolder> control.
[!code-xml[System.Web.UI.MasterPage_1#1](~/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.MasterPage_1/CS/MasterPageSample_1cs.master#1)]
The following code example demonstrates a content page for the preceding master page. The text, markup, and any server controls defined within the <xref:System.Web.UI.WebControls.Content> control template are rendered to the <xref:System.Web.UI.WebControls.ContentPlaceHolder> on the master page.
[!code-csharp[System.Web.UI.MasterPage_1#3](~/snippets/csharp/VS_Snippets_WebNet/System.Web.UI.MasterPage_1/CS/samplemasterclass.cs#3)]
[!code-vb[System.Web.UI.MasterPage_1#3](~/snippets/visualbasic/VS_Snippets_WebNet/System.Web.UI.MasterPage_1/VB/samplemasterclass.vb#3)]
]]></format>
</remarks>
<altmember cref="T:System.Web.UI.WebControls.Content" />
<altmember cref="T:System.Web.UI.MasterPage" />
</Docs>
<Members>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public ContentPlaceHolder ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
<MemberSignature Language="DocId" Value="M:System.Web.UI.WebControls.ContentPlaceHolder.#ctor" />
<MemberSignature Language="VB.NET" Value="Public Sub New ()" />
<MemberSignature Language="C++ CLI" Value="public:
 ContentPlaceHolder();" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>System.Web</AssemblyName>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<AssemblyVersion>4.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute FrameworkAlternate="netframework-4.0">
<AttributeName Language="C#">[System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")]</AttributeName>
<AttributeName Language="F#">[<System.Runtime.TargetedPatchingOptOut("Performance critical to inline this type of method across NGen image boundaries")>]</AttributeName>
</Attribute>
</Attributes>
<Parameters />
<Docs>
<summary>Initializes a new instance of the <see cref="T:System.Web.UI.WebControls.ContentPlaceHolder" /> class.</summary>
<remarks>To be added.</remarks>
<altmember cref="T:System.Web.UI.WebControls.Content" />
<altmember cref="T:System.Web.UI.MasterPage" />
</Docs>
</Member>
</Members>
</Type>