WebPartManager.SupportedDisplayModes プロパティ
アセンブリ: System.Web (system.web.dll 内)

Dim instance As WebPartManager Dim value As WebPartDisplayModeCollection value = instance.SupportedDisplayModes
public: property WebPartDisplayModeCollection^ SupportedDisplayModes { WebPartDisplayModeCollection^ get (); }
特定の 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 つのヘッダーにあるドロップダウンの動詞メニューをクリックし、[編集] を選択してコントロールを編集します。

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からWebPartManager.SupportedDisplayModes プロパティを検索する場合は、下記のリンクをクリックしてください。

- WebPartManager.SupportedDisplayModes プロパティのページへのリンク