WebPartManager.GetProviderConnectionPoints メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > WebPartManager.GetProviderConnectionPoints メソッドの意味・解説 

WebPartManager.GetProviderConnectionPoints メソッド

メモ : このメソッドは、.NET Framework version 2.0新しく追加されたものです。

Web パーツ接続内でプロバイダとして動作するサーバー コントロールから、コネクション ポイントとして機能できる ProviderConnectionPoint オブジェクトコレクション取得します

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

Public Overridable Function
 GetProviderConnectionPoints ( _
    webPart As WebPart _
) As ProviderConnectionPointCollection
Dim instance As WebPartManager
Dim webPart As WebPart
Dim returnValue As ProviderConnectionPointCollection

returnValue = instance.GetProviderConnectionPoints(webPart)
public virtual ProviderConnectionPointCollection GetProviderConnectionPoints
 (
    WebPart webPart
)
public:
virtual ProviderConnectionPointCollection^ GetProviderConnectionPoints (
    WebPart^ webPart
)
public ProviderConnectionPointCollection GetProviderConnectionPoints
 (
    WebPart webPart
)
public function GetProviderConnectionPoints
 (
    webPart : WebPart
) : ProviderConnectionPointCollection

パラメータ

webPart

接続プロバイダとして動作するサーバー コントロール

戻り値
プロバイダすべてのコネクション ポイント格納された ProviderConnectionPointCollection。

例外例外
例外種類条件

ArgumentNullException

webPartnull 参照 (Visual Basic では Nothing) です。

解説解説
使用例使用例

GetProviderConnectionPoints メソッド使用する方法次のコード例示します

この例は、4 つ部分構成されます。

コード例最初部分は、表示モード変更するユーザー コントロールです。このユーザー コントロールソース コードは、WebPartManager クラス概要の「例」から取得できます表示モード詳細およびユーザー コントロール動作方法詳細については、「チュートリアル : Web パーツ ページでの表示モード変更」を参照してください

Web ページ宣言マークアップには、ユーザー コントロールカスタム コントロール両方Register ディレクティブ含まれています。<asp:webpartmanager> 要素カスタム コントロール格納する <asp:webpartzone> 要素、および <asp:connectionszone> 要素ありますPage_Load メソッドで、コード接続が既に存在しているかどうかチェックし存在してない場合は、プロバイダコンシューマ、およびそのそれぞれのコネクション ポイント定義し新し接続を StaticConnections プロパティ参照される静的接続セット追加しますGetProviderConnectionPoints メソッド使用して取得した ProviderConnectionPointCollection オブジェクトは CanConnectWebParts メソッド渡され2 つコントロールの間に接続作成できるかどうか判断します

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

コード例3 番目の部分は、コントロールソース コードです。このコード自体、およびコードコンパイルする手順説明は、WebPartManager クラス概要の「例」から取得できます

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

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


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

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

辞書ショートカット

すべての辞書の索引

WebPartManager.GetProviderConnectionPoints メソッドのお隣キーワード
検索ランキング

   

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



WebPartManager.GetProviderConnectionPoints メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS