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

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

WebPartManager.StaticConnections プロパティ

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

Web ページ上の静的接続として定義されているすべての WebPartConnection オブジェクトコレクションへの参照取得します

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

Public ReadOnly Property
 StaticConnections As WebPartConnectionCollection
Dim instance As WebPartManager
Dim value As WebPartConnectionCollection

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

プロパティ
ページ上のすべての静的接続格納された WebPartConnectionCollection。

解説解説
使用例使用例

StaticConnections プロパティプログラムでの使用方法を示すコード例次に示します

コード例は、次の 4 つ部分から成ります

次のコードには、コード例Web ページ部分のみが含まれています。また、WebPartManager クラス概要の「例」から、その例の最初2 つ部分カスタム ユーザー コントロールおよびカスタム コントロールインターフェイスソース コード取得する必要があります。そのトピックでは、WebPart コントロールコンパイルするオプションについても説明してます。

コード例3 番目の部分Web ページです。このページ宣言マークアップには、ユーザー コントロールカスタム コントロール両方Register ディレクティブ含まれています。<asp:webpartmanager> 要素カスタム コントロール格納する <asp:webpartzone> 要素、および <asp:connectionszone> 要素ありますPage_Load メソッドで、コードにより接続が既に存在しているかどうかチェックされ存在してない場合は、プロバイダコンシューマ、およびそのそれぞれのコネクション ポイント定義し新し接続StaticConnections プロパティ参照される静的接続セット追加します

<%@ Page Language="vb" %>
<%@ register TagPrefix="uc1" 
  TagName="DisplayModeMenuVB" 
  Src="DisplayModeMenuVB.ascx" %>
<%@ register tagprefix="aspSample" 
  Namespace="Samples.AspNet.VB.Controls"
 
  Assembly="ConnectionSampleVB"%>

<script runat="server">

  Protected Sub Page_Load(ByVal
 sender As Object, _
    ByVal e As System.EventArgs)
    
    ' Define provider, consumer, and connection points.
    Dim provider As WebPart = mgr.WebParts("zip1")
    Dim provConnPoint As ProviderConnectionPoint
 = _
      mgr.GetProviderConnectionPoints(provider)("ZipCodeProvider")
    Dim consumer As WebPart = mgr.WebParts("weather1")
    Dim consConnPoint As ConsumerConnectionPoint
 = _
      mgr.GetConsumerConnectionPoints(consumer)("ZipCodeConsumer")
    
    ' Check whether the connection already exists.
    If mgr.CanConnectWebParts(provider, provConnPoint, _
      consumer, consConnPoint) Then
      ' Create a new static connection.
      Dim conn As New WebPartConnection()
      conn.ID = "staticConn1"
      conn.ConsumerID = "weather1"
      conn.ConsumerConnectionPointID = "ZipCodeConsumer"
      conn.ProviderID = "zip1"
      conn.ProviderConnectionPointID = "ZipCodeProvider"
      mgr.StaticConnections.Add(conn)
    End If
    
  End Sub
  
</script>

<html  >
<head id="Head1" runat="server">
</head>
<body>
    <form id="form1" runat="server">
      <!-- Reference the WebPartManager control. -->
      <asp:WebPartManager ID="mgr" runat="server"
 />   
    <div>
      <uc1:DisplayModeMenuVB ID="displaymode1"
 
        runat="server" />
      <!-- Reference consumer and provider controls 
           in a zone. -->
      <asp:WebPartZone ID="WebPartZone1" runat="server">
        <ZoneTemplate>
          <aspSample:ZipCodeWebPart ID="zip1" 
            runat="server" 
            Title="Zip Code Control"/>
          <aspSample:WeatherWebPart ID="weather1"
 
            runat="server" 
            Title="Weather Control" />
        </ZoneTemplate>
      </asp:WebPartZone>
      <hr />
      <!-- Add a ConnectionsZone so users can connect 
           controls. -->
      <asp:ConnectionsZone ID="ConnectionsZone1"
 
        runat="server" />
    </div>
    </form>
</body>
</html>
<%@ Page Language="C#" %>
<%@ register TagPrefix="uc1" 
  TagName="DisplayModeMenuCS" 
  Src="DisplayModeMenuCS.ascx" %>
<%@ register tagprefix="aspSample" 
  Namespace="Samples.AspNet.CS.Controls" 
  Assembly="ConnectionSampleCS"%>

<script runat="server">

  protected void Page_Load(object sender, EventArgs
 e)
  {
    
    // Define provider, consumer, and connection points.
    WebPart provider = mgr.WebParts["zip1"];
    ProviderConnectionPoint provConnPoint =
      mgr.GetProviderConnectionPoints(provider)["ZipCodeProvider"];
    WebPart consumer = mgr.WebParts["weather1"];
    ConsumerConnectionPoint consConnPoint =
      mgr.GetConsumerConnectionPoints(consumer)["ZipCodeConsumer"];
    
    // Check whether the connection already exists.
    if (mgr.CanConnectWebParts(provider, provConnPoint,
      consumer, consConnPoint))
    {
      // Create a new static connection.
      WebPartConnection conn = new WebPartConnection();
      conn.ID = "staticConn1";
      conn.ConsumerID = "weather1";
      conn.ConsumerConnectionPointID = "ZipCodeConsumer";
      conn.ProviderID = "zip1";
      conn.ProviderConnectionPointID = "ZipCodeProvider";
      mgr.StaticConnections.Add(conn);
    }
 }

</script>

<html  >
<head id="Head1" runat="server">
</head>
<body>
    <form id="form1" runat="server">
      <!-- Reference the WebPartManager control. -->
      <asp:WebPartManager ID="mgr" runat="server" />  
 
    <div>
      <uc1:DisplayModeMenuCS ID="displaymode1" 
        runat="server" />
      <!-- Reference consumer and provider controls 
           in a zone. -->
      <asp:WebPartZone ID="WebPartZone1" runat="server">
        <ZoneTemplate>
          <aspSample:ZipCodeWebPart ID="zip1" 
            runat="server" 
            Title="Zip Code Control"/>
          <aspSample:WeatherWebPart ID="weather1" 
            runat="server" 
            Title="Weather Control" />
        </ZoneTemplate>
      </asp:WebPartZone>
      <hr />
      <!-- Add a ConnectionsZone so users can connect 
           controls. -->
      <asp:ConnectionsZone ID="ConnectionsZone1" 
        runat="server" />
    </div>
    </form>
</body>
</html>

ブラウザWeb ページ読み込んだ後、[Display Mode] ドロップダウン リスト コントロールクリックし、[接続] を選択してページ接続モード切り替えます接続モードは、<asp:connectionszone> 要素使用してコントロールの間に接続作成できるようにします。接続モードで、[ZIP Code] コントロールタイトル バーにある下向き矢印クリックしてその動詞メニューアクティブにし、[接続] をクリックします。接続ユーザー インターフェイス (UI) が表示されたら、Page_Load メソッド格納されているコードによって既に接続作成されていることを確認します。後のブラウザ セッションでこのページに戻る場合、この静的接続は既に確立されているため、ページ読み込むたびに再作成する必要はありません。

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
WebPartManager クラス
WebPartManager メンバ
System.Web.UI.WebControls.WebParts 名前空間
WebPartConnection クラス
その他の技術情報
ASP.NET Web パーツ ページ


このページでは「.NET Framework クラス ライブラリ リファレンス」からWebPartManager.StaticConnections プロパティを検索した結果を表示しています。
Weblioに収録されているすべての辞書からWebPartManager.StaticConnections プロパティを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からWebPartManager.StaticConnections プロパティ を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

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

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

   

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



WebPartManager.StaticConnections プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS