WebPartManager.SupportedDisplayModes プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > WebPartManager.SupportedDisplayModes プロパティの意味・解説 

WebPartManager.SupportedDisplayModes プロパティ

メモ : このプロパティは、.NET Framework version 2.0 で新しく追加されたものです。

特定の Web ページ上で使用できるすべての表示モードの読み取り専用のコレクションを取得します。

名前空間: System.Web.UI.WebControls.WebParts
アセンブリ: System.Web (system.web.dll 内)
構文構文

Public ReadOnly Property
 SupportedDisplayModes As WebPartDisplayModeCollection
Dim instance As WebPartManager
Dim value As WebPartDisplayModeCollection

value = instance.SupportedDisplayModes
public WebPartDisplayModeCollection SupportedDisplayModes { get;
 }
public:
property WebPartDisplayModeCollection^ SupportedDisplayModes {
    WebPartDisplayModeCollection^ get ();
}
/** @property */
public WebPartDisplayModeCollection get_SupportedDisplayModes
 ()
public function get SupportedDisplayModes
 () : WebPartDisplayModeCollection

プロパティ値
特定の Web ページ上で使用できる WebPartDisplayMode オブジェクトのセットが格納された WebPartDisplayModeCollection。

解説解説

SupportedDisplayModes プロパティには、ページ上に存在するゾーン コントロールの種類を指定して、そのページで実際に使用できる表示モードだけが格納されます。

メモメモ

表示モードは無効にできます。表示モードを無効にすると、その表示モードのサポートに対応する種類のゾーンがページ上に存在する場合でも、それは SupportedDisplayModes コレクションに追加されません。

ブラウズ モードとデザイン モードは常にサポートされます。サポートされない可能性のある表示モードは、編集モード、カタログ モード、および接続モードです。これらの表示モードそれぞれが、特定の種類の ToolZone コントロールに関連付けられます。Web ページ上に特別に型指定されたゾーンが存在すると、SupportedDisplayModes プロパティで参照されるコレクションに特定の表示モードが追加されます。たとえば、Web ページに EditorZone ゾーンは含まれていても CatalogZone ゾーンは含まれていない場合、編集表示モードはそのページでサポートされますが、カタログ表示モードはサポートされません。

使用例使用例

SupportedDisplayModes プロパティのプログラムでの使用方法を示すコード例を次に示します。コードは、このプロパティを使用して、現在の Web ページで使用できる表示モードだけのリストを作成します。

このページには、サポートされる表示モードとして、ブラウズ、デザイン、および編集の 3 つが存在します。最初の 2 つは常に使用可能で、ページに EditorZone コントロールが含まれているため、このコード例では編集モードを使用できます。カタログ表示モードと接続表示モードは、このページに対応するゾーンがないため表示されません。

<%@ Page Language="VB" %>

<script runat="server">

  Protected Sub Page_Init(ByVal
 sender As Object, _
    ByVal e As EventArgs)
    Dim mode As WebPartDisplayMode
    For Each mode In mgr.SupportedDisplayModes
      Dim modeName As String
 = mode.Name
      If mode.IsEnabled(mgr) Then
        Dim item As ListItem = New
 ListItem(modeName, modeName)
        DisplayModeDropdown.Items.Add(item)
      End If
    Next
    
  End Sub

  Protected Sub DisplayModeDropdown_SelectedIndexChanged(ByVal
 _
    sender As Object, ByVal
 e As EventArgs)
    Dim selectedMode As String
 = _
      DisplayModeDropdown.SelectedValue
    Dim mode As WebPartDisplayMode = _
      mgr.SupportedDisplayModes(selectedMode)
    If mode IsNot Nothing Then
      mgr.DisplayMode = mode
    End If
  End Sub
  
</script>

<html  >
<head runat="server">
</head>
<body>
    <form id="form1" runat="server">
    <div>
      <asp:WebPartManager ID="mgr" runat="server">
      </asp:WebPartManager>
      <asp:WebPartZone ID="WebPartZone1" runat="server">
        <ZoneTemplate>
          <asp:Calendar ID="Calendar1" runat="server"
 
            Title="My Calendar" />
        </ZoneTemplate>
      </asp:WebPartZone>
      <asp:WebPartZone ID="WebPartZone2" runat="server">
        <ZoneTemplate>
          <asp:BulletedList 
            DisplayMode="HyperLink" 
            ID="BulletedList1" 
            runat="server"
            Title="My Links">
            <asp:ListItem Value="http://www.microsoft.com">
            Microsoft
            </asp:ListItem>
            <asp:ListItem Value="http://www.msn.com">
            MSN
            </asp:ListItem>
            <asp:ListItem Value="http://www.contoso.com">
            Contoso Corp.
            </asp:ListItem>
          </asp:BulletedList>
        </ZoneTemplate>
      </asp:WebPartZone>
      <asp:EditorZone ID="EditorZone1" runat="server">
        <ZoneTemplate>
          <asp:AppearanceEditorPart runat="server"
 
            ID="Appearance1">
          </asp:AppearanceEditorPart>
          <asp:LayoutEditorPart runat="server"
 ID="Layout1">
          </asp:LayoutEditorPart>
        </ZoneTemplate>
      </asp:EditorZone>
      <hr />
      <asp:DropDownList ID="DisplayModeDropdown"
 runat="server" 
        AutoPostBack="true"
        Width="120"
        OnSelectedIndexChanged=
        "DisplayModeDropdown_SelectedIndexChanged">
      </asp:DropDownList>
    </div>
    </form>
</body>
</html>
<%@ Page Language="C#" %>

<script runat="server">

  protected void Page_Init(object sender, EventArgs
 e)
  {
    foreach (WebPartDisplayMode mode in mgr.SupportedDisplayModes)
    {
      string modeName = mode.Name;
      if (mode.IsEnabled(mgr))
      {
        ListItem item = new ListItem(modeName, modeName);
        DisplayModeDropdown.Items.Add(item);
      }      
    }
  }

  protected void DisplayModeDropdown_SelectedIndexChanged(object
 
    sender, EventArgs e)
  {
    String selectedMode = DisplayModeDropdown.SelectedValue;
    WebPartDisplayMode mode = 
      mgr.SupportedDisplayModes[selectedMode];
    if (mode != null)
      mgr.DisplayMode = mode;
  }
  
</script>

<html  >
<head runat="server">
</head>
<body>
    <form id="form1" runat="server">
    <div>
      <asp:WebPartManager ID="mgr" runat="server">
      </asp:WebPartManager>
      <asp:WebPartZone ID="WebPartZone1" runat="server">
        <ZoneTemplate>
          <asp:Calendar ID="Calendar1" runat="server" 
            Title="My Calendar" />
        </ZoneTemplate>
      </asp:WebPartZone>
      <asp:WebPartZone ID="WebPartZone2" runat="server">
        <ZoneTemplate>
          <asp:BulletedList 
            DisplayMode="HyperLink" 
            ID="BulletedList1" 
            runat="server"
            Title="My Links">
            <asp:ListItem Value="http://www.microsoft.com">
            Microsoft
            </asp:ListItem>
            <asp:ListItem Value="http://www.msn.com">
            MSN
            </asp:ListItem>
            <asp:ListItem Value="http://www.contoso.com">
            Contoso Corp.
            </asp:ListItem>
          </asp:BulletedList>
        </ZoneTemplate>
      </asp:WebPartZone>
      <asp:EditorZone ID="EditorZone1" runat="server">
        <ZoneTemplate>
          <asp:AppearanceEditorPart runat="server" 
            ID="Appearance1">
          </asp:AppearanceEditorPart>
          <asp:LayoutEditorPart runat="server" ID="Layout1">
          </asp:LayoutEditorPart>
        </ZoneTemplate>
      </asp:EditorZone>
      <hr />
      <asp:DropDownList ID="DisplayModeDropdown" runat="server"
 
        AutoPostBack="true"
        Width="120"
        OnSelectedIndexChanged=
        "DisplayModeDropdown_SelectedIndexChanged">
      </asp:DropDownList>
    </div>
    </form>
</body>
</html>

ブラウザにページを読み込んだ後、ドロップダウン リスト コントロールを使用して、ブラウズ モードからデザイン モードにページを切り替え、次に編集モードに切り替えることができます。編集モードで、サーバー コントロールの 1 つのヘッダーにあるドロップダウンの動詞メニューをクリックし、[編集] を選択してコントロールを編集します。

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳

英語⇒日本語日本語⇒英語

辞書ショートカット

すべての辞書の索引

WebPartManager.SupportedDisplayModes プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



WebPartManager.SupportedDisplayModes プロパティのページの著作権

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2026 Microsoft.All rights reserved.

©2026 GRAS Group, Inc.RSS