クリックして評価とフィードバックをお寄せください
MSDN
MSDN ライブラリ
.NET 開発
.NET Framework 3.5
.NET Framework 3.5
Content クラス

  低帯域幅での表示をオンにする
このページは次のバージョンについて記述しています。
Microsoft Visual Studio 2008/.NET Framework 3.5

その他のバージョンについては、以下の情報を参照してください。
.NET Framework クラス ライブラリ
Content クラス

更新 : 2007 年 11 月

マスタ ページの ContentPlaceHolder コントロールに表示するテキスト、マークアップ、およびサーバー コントロールを保持します。

名前空間 :  System.Web.UI.WebControls
アセンブリ :  System.Web (System.Web.dll 内)

Visual Basic (宣言)
<AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level := AspNetHostingPermissionLevel.Minimal)> _
<AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level := AspNetHostingPermissionLevel.Minimal)> _
Public Class Content _
    Inherits Control _
    Implements INamingContainer
Visual Basic (使用法)
Dim instance As Content
C#
[AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal)]
[AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal)]
public class Content : Control, INamingContainer
Visual C++
[AspNetHostingPermissionAttribute(SecurityAction::InheritanceDemand, Level = AspNetHostingPermissionLevel::Minimal)]
[AspNetHostingPermissionAttribute(SecurityAction::LinkDemand, Level = AspNetHostingPermissionLevel::Minimal)]
public ref class Content : public Control, 
    INamingContainer
J#
/** @attribute AspNetHostingPermissionAttribute(SecurityAction.InheritanceDemand, Level = AspNetHostingPermissionLevel.Minimal) */
/** @attribute AspNetHostingPermissionAttribute(SecurityAction.LinkDemand, Level = AspNetHostingPermissionLevel.Minimal) */
public class Content extends Control implements INamingContainer
JScript
public class Content extends Control implements INamingContainer
ASP.NET
<asp:Content />

Content コントロールは、コンテンツ ページのコンテンツおよびコントロールのコンテナです。Content コントロールは、対応する ContentPlaceHolder コントロールを定義するマスタ ページと一緒に使用します。Content コントロールは、実行時にコントロール階層構造に追加されません。その代わりに、Content コントロール内のコンテンツは、対応する ContentPlaceHolder コントロールに直接マージされます。

Content コントロールは、ContentPlaceHolderID プロパティを使用して ContentPlaceHolder に関連付けられます。マスタ ページで、ContentPlaceHolderID プロパティに、ContentPlaceHolder コントロールの ID プロパティの値を設定します。コンテンツ ページの URL が呼び出されると、Content コントロール内に格納されているすべてのテキスト、マークアップ、およびサーバー コントロールが、マスタ ページの ContentPlaceHolder に表示され、さらにブラウザのアドレス バーにはコンテンツ ページの名前が表示されます。

マスタ ページおよびコンテンツ ページの詳細については、「ASP.NET マスター ページの概要」を参照してください。

Content コントロールを使用して、マスタ ページのコンテンツを定義する方法を次のコード例に示します。最初の Web ページがマスタ ページであり、 ContentPlaceHolder コントロールを使用してコンテンツ領域を定義しています。

Visual Basic
<%@ 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>

C#
<%@ 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 に表示されます。

C#
<%@ Page Language="C#" MasterPageFile="~/MasterPageSample_1cs.master" Title="Content Page"%>

<asp:content 
    runat="server"
    contentplaceholderid="ContentPlaceHolder1" >Hello, Master Pages!</asp:content>
Visual Basic
<%@ Page Language="VB" MasterPageFile="~/MasterPageSample_1vb.master" Title="Content Page"%>

<asp:content 
    runat="server"
    contentplaceholderid="ContentPlaceHolder1" >Hello, Master Pages!</asp:content>
  • AspNetHostingPermission 

    (ホスト環境で Content コントロールを実行するために必要なアクセス許可)。Minimal (関連する列挙体)

  • AspNetHostingPermission 

    (ホスト環境で Content コントロールを実行するために必要なアクセス許可)。Minimal (関連する列挙体)

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
コミュニティ コンテンツ   コミュニティ コンテンツとは
新しいコンテンツの追加 RSS  注釈
Processing
© 2009 Microsoft Corporation. All rights reserved. 使用条件  |  商標  |  プライバシー
Page view tracker