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

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

ProxyWebPartManager.StaticConnections プロパティ

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

コンテンツ ページの <asp:proxywebpartmanager> 要素で宣言されている静的接続のコレクションを取得します。

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

Public ReadOnly Property
 StaticConnections As ProxyWebPartConnectionCollection
Dim instance As ProxyWebPartManager
Dim value As ProxyWebPartConnectionCollection

value = instance.StaticConnections
public ProxyWebPartConnectionCollection StaticConnections { get;
 }
public:
property ProxyWebPartConnectionCollection^ StaticConnections {
    ProxyWebPartConnectionCollection^ get ();
}
/** @property */
public ProxyWebPartConnectionCollection get_StaticConnections
 ()
public function get StaticConnections
 () : ProxyWebPartConnectionCollection

プロパティ値
<asp:proxywebpartmanager> 要素で宣言されているすべての静的な WebPartConnection オブジェクトを格納する ProxyWebPartConnectionCollection。

解説解説

StaticConnections プロパティは、<asp:proxywebpartmanager> 要素で宣言されている WebPartConnection オブジェクトのコレクションを参照します。このコレクションに格納されている接続は、WebPartManager.StaticConnections コレクションによって参照される WebPartManager コントロール の静的接続に追加され、WebPartManager コントロールに関連付けられている他の接続とまったく同様に扱われます。

StaticConnections プロパティに対応する宣言要素は <staticconnections> 要素です。マスタ ページを使用するアプリケーションでは、<staticconnections> 要素がコンテンツ ページの <asp:proxywebpartmanager> 要素の子として追加され、<asp:webpartconnection> 要素が <staticconnections> 要素の子として追加されます。1 つの <staticconnections> 要素には複数の <asp:webpartconnection> 要素を追加でき、複数のコンテンツ ページはマスタ ページ アプリケーションの一部として静的接続を宣言できます。

使用例使用例

ProxyWebPartManager クラスの StaticConnections プロパティの使用方法を次のコード例に示します。このコード例では、ProxyWebPartManager コントロールと静的接続を宣言するコンテンツ ページのコードの関連部分だけを示しています。コードの実行に必要なその他のページと、その設定方法の説明については、ProxyWebPartManager クラスの概要の「使用例」を参照してください。

次のコードは、<staticconnections> 要素を <asp:proxywebpartmanager> 要素の子として宣言するコンテンツ ページです。また、Button1_Click メソッドは ProxyWebPartManager コントロールの StaticConnections プロパティの数を確認し、それをページに書き込みます。

<%@ Page Language="VB" MasterPageFile="~/MasterPageVB.master"
 
  Title="Connections Page" %>
<%@ Register TagPrefix="aspSample" 
    Namespace="Samples.AspNet.VB.Controls"
 %>

<script runat="server">

  Protected Sub Button1_Click(ByVal
 sender As Object, _
    ByVal e As EventArgs)

    Dim lblText As StringBuilder = New
 StringBuilder()

    If Not (Page.Master.FindControl("WebPartManager1")
 Is Nothing) Then
      Dim theMgr As WebPartManager = _
        CType(Page.Master.FindControl("WebPartManager1"),
 WebPartManager)
      lblText.Append("WebPartManager:  <br /><pre>"
 & _
        "  Master page file is " & Page.MasterPageFile
 & "<br />" & _
        "  ID is " & theMgr.ID & "<br
 />" & _
        "  Connection count is " & _
           theMgr.StaticConnections.Count.ToString() & "<br
 />" & _
        "  WebParts count is " & _
           theMgr.WebParts.Count.ToString() & "</pre><br
 />")
    End If

    If Not (proxymgr1 Is
 Nothing) Then
      lblText.Append("ProxyWebPartManager:  <br /><pre>"
 & _
        "  Content page file is " & Request.Path
 & "<br />" & _
        "  ID is " & proxymgr1.ID & "<br
 />" & _
        "  Connection count is " & _
           proxymgr1.StaticConnections.Count.ToString() & "</pre><br
 />")
    End If

    Literal1.Text = lblText.ToString()
    
  End Sub

</script>

<asp:Content ID="Content1" Runat="Server"
 
  ContentPlaceHolderID="ContentPlaceHolder1" >

  <asp:proxywebpartmanager id="proxymgr1" runat="server">
    <staticconnections>
      <asp:webpartconnection id="connection1" 
        consumerconnectionpointid="ZipCodeConsumer"
        consumerid="zipConsumer"
        providerconnectionpointid="ZipCodeProvider"
 
        providerid="zipProvider" />
    </staticconnections>    
  </asp:proxywebpartmanager>

  <div>
  <asp:webpartzone id="zone1" runat="server">
    <zonetemplate>
      <aspsample:zipcodewebpart id="zipProvider"
 runat="server" 
        title="Zip Code Provider"  />
      <aspsample:weatherwebpart id="zipConsumer"
 runat="server" 
        title="Zip Code Consumer" />
    </zonetemplate>
  </asp:webpartzone>
  </div>
  
  <div>
  <asp:button id="Button1" runat="server"
 
    text="WebPartManager Information" onclick="Button1_Click"
 />
  <br />
  <asp:literal id="Literal1" runat="server"
 />
  </div>
  
  <asp:connectionszone id="ConnectionsZone1" runat="server"
 />
  
</asp:Content>
<%@ Page Language="C#" MasterPageFile="~/MasterPageCS.master"
 
  Title="Connections Page" %>
<%@ Register TagPrefix="aspSample" 
    Namespace="Samples.AspNet.CS.Controls" %>

<script runat="server">

  protected void Button1_Click(object sender,
 EventArgs e)
  {
    StringBuilder lblText = new StringBuilder();
    
    if (Page.Master.FindControl("WebPartManager1") !=
 null)
    {
      WebPartManager theMgr = 
        (WebPartManager)Page.Master.FindControl("WebPartManager1");
      lblText.Append("WebPartManager:  <br /><pre>" +
        "  Master page file is " + Page.MasterPageFile + "<br />"
 +
        "  ID is " + theMgr.ID + "<br />" +
        "  Connection count is " +
           theMgr.StaticConnections.Count.ToString() + "<br />" +
        "  WebParts count is " +
           theMgr.WebParts.Count.ToString() + "</pre><br />");
    }

    if (proxymgr1 != null)
    {
      lblText.Append("ProxyWebPartManager:  <br /><pre>" +
        "  Content page file is " + Request.Path + "<br />"
 +
        "  ID is " + proxymgr1.ID + "<br />" +
        "  Connection count is " +
           proxymgr1.StaticConnections.Count.ToString() + 
           "</pre><br />");
    }

    Literal1.Text = lblText.ToString();
    
  }
  
</script>

<asp:Content ID="Content1" Runat="Server" 
  ContentPlaceHolderID="ContentPlaceHolder1" >
 
  <asp:proxywebpartmanager id="proxymgr1" runat="server">
    <staticconnections>
      <asp:webpartconnection id="connection1" 
        consumerconnectionpointid="ZipCodeConsumer"
        consumerid="zipConsumer"
        providerconnectionpointid="ZipCodeProvider" 
        providerid="zipProvider" />
    </staticconnections>    
  </asp:proxywebpartmanager>

  <div>
  <asp:webpartzone id="zone1" runat="server">
    <zonetemplate>
      <aspsample:zipcodewebpart id="zipProvider" runat="server"
 
        title="Zip Code Provider"  />
      <aspsample:weatherwebpart id="zipConsumer" runat="server"
 
        title="Zip Code Consumer" />
    </zonetemplate>
  </asp:webpartzone>
  </div>
  
  <div>
  <asp:button id="Button1" runat="server" 
    text="WebPartManager Information" onclick="Button1_Click"
 />
  <br />
  
  </div>
  
  <asp:connectionszone id="ConnectionsZone1" runat="server"
 />
  <asp:literal id="Literal1" runat="server" />

</asp:Content>

ページをブラウザに読み込んだら、[WebPartManager Information] ボタンをクリックして、マスタ ページの WebPartManager コントロールに関する情報とコンテンツ ページの ProxyWebPartManager コントロールに関する情報を確認します。たとえば、それぞれのコントロールの静的接続を追跡するプロパティ (StaticConnections プロパティ) の値は同じです。

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ProxyWebPartManager クラス
ProxyWebPartManager メンバ
System.Web.UI.WebControls.WebParts 名前空間
WebPartManager.StaticConnections



英和和英テキスト翻訳

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

辞書ショートカット

すべての辞書の索引

「ProxyWebPartManager.StaticConnections プロパティ」の関連用語

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

   

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



ProxyWebPartManager.StaticConnections プロパティのページの著作権

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

©2026 GRAS Group, Inc.RSS