更新 : 2007 年 11 月
名前空間 :
System.Web.UI.WebControls アセンブリ :
System.Web (System.Web.dll 内)
<AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level := AspNetHostingPermissionLevel.Minimal)> _
<AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level := AspNetHostingPermissionLevel.Minimal)> _
Public Class Content _
Inherits Control _
Implements INamingContainer
[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public class Content : Control, INamingContainer
[AspNetHostingPermissionAttribute(SecurityAction::InheritanceDemand, Level = AspNetHostingPermissionLevel::Minimal)]
[AspNetHostingPermissionAttribute(SecurityAction::LinkDemand, Level = AspNetHostingPermissionLevel::Minimal)]
public ref class Content : public Control,
INamingContainer
/** @attribute AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal) */
/** @attribute AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal) */
public class Content extends Control implements INamingContainer
public class Content extends Control implements INamingContainer
Content コントロールは、コンテンツ ページのコンテンツおよびコントロールのコンテナです。Content コントロールは、対応する ContentPlaceHolder コントロールを定義するマスタ ページと一緒に使用します。Content コントロールは、実行時にコントロール階層構造に追加されません。その代わりに、Content コントロール内のコンテンツは、対応する ContentPlaceHolder コントロールに直接マージされます。
Content コントロールは、ContentPlaceHolderID プロパティを使用して ContentPlaceHolder に関連付けられます。マスタ ページで、ContentPlaceHolderID プロパティに、ContentPlaceHolder コントロールの ID プロパティの値を設定します。コンテンツ ページの URL が呼び出されると、Content コントロール内に格納されているすべてのテキスト、マークアップ、およびサーバー コントロールが、マスタ ページの ContentPlaceHolder に表示され、さらにブラウザのアドレス バーにはコンテンツ ページの名前が表示されます。
マスタ ページおよびコンテンツ ページの詳細については、「ASP.NET マスター ページの概要」を参照してください。
Content コントロールを使用して、マスタ ページのコンテンツを定義する方法を次のコード例に示します。最初の Web ページがマスタ ページであり、 ContentPlaceHolder コントロールを使用してコンテンツ領域を定義しています。
<%@ Master Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html >
<head runat="server">
<title>MasterPage Example</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:contentplaceholder id="ContentPlaceHolder1" runat="server" />
</div>
</form>
</body>
</html>
<%@ Master Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html >
<head runat="server">
<title>MasterPage Example</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:contentplaceholder id="ContentPlaceHolder1" runat="server" />
</div>
</form>
</body>
</html>
先のマスタ ページに対してコンテンツ ページを使用する方法を、次のコード例に示します。Content コントロール テンプレート内で定義されているテキスト、マークアップ、およびサーバー コントロールが、マスタ ページの ContentPlaceHolder に表示されます。
<%@ 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>
System..::.Object
System.Web.UI..::.Control
System.Web.UI.WebControls..::.Content
この型のすべてのパブリック static (Visual Basic では Shared) メンバは、スレッド セーフです。インスタンス メンバの場合は、スレッド セーフであるとは限りません。
Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
.NET Framework および .NET Compact Framework では、各プラットフォームのすべてのバージョンはサポートしていません。サポートされているバージョンについては、「.NET Framework システム要件」を参照してください。
.NET Framework
サポート対象 : 3.5、3.0、2.0
参照
その他の技術情報