Content.ContentPlaceHolderID 属性
定义
获取或设置与当前内容关联的 ContentPlaceHolder 控件的 ID。Gets or sets the ID of the ContentPlaceHolder control that is associated with the current content.
public:
property System::String ^ ContentPlaceHolderID { System::String ^ get(); void set(System::String ^ value); };
[System.Web.UI.Themeable(false)]
public string ContentPlaceHolderID { get; set; }
[<System.Web.UI.Themeable(false)>]
member this.ContentPlaceHolderID : string with get, set
Public Property ContentPlaceHolderID As String
属性值
一个字符串,包含与当前内容关联的 ContentPlaceHolder 的 ID。A string containing the ID of the ContentPlaceHolder associated with the current content. 默认值为空字符串("")。The default is an empty string ("").
- 属性
例外
曾尝试在运行时设置此属性。An attempt was made to set the property at run time.
示例
下面的代码示例演示如何 ContentPlaceHolderID ContentPlaceHolder 在 ASP.NET 网页中使用控件的属性。The following code example shows how to use the ContentPlaceHolderID property of a ContentPlaceHolder control in an ASP.NET Web page.
此代码示例是为类提供的更大示例的一部分 Content 。This code example is part of a larger example provided for the Content class.
<%@ Page Language="C#" MasterPageFile="~/MasterPageSample_1cs.master" Title="Content Page"%>
<asp:content
runat="server"
contentplaceholderid="ContentPlaceHolder1" >Hello, Master Pages!</asp:content>
<%@ Page Language="VB" MasterPageFile="~/MasterPageSample_1vb.master" Title="Content Page"%>
<asp:content
runat="server"
contentplaceholderid="ContentPlaceHolder1" >Hello, Master Pages!</asp:content>
注解
控件封装的所有内容都在 Content 母版页中的引用控件中呈现 ContentPlaceHolder 。All content that is encapsulated by the Content control renders within the referenced ContentPlaceHolder control in a master page. Content在运行时,控件不会添加到控件层次结构中。A Content control is not added to the control hierarchy at runtime.
无法通过主题或样式表主题设置此属性。This property cannot be set by themes or style sheet themes. 有关详细信息,请参阅 ThemeableAttribute 和 ASP.NET 主题和外观。For more information, see ThemeableAttribute and ASP.NET Themes and Skins.