ConnectionsZone クラスとは? わかりやすく解説

ConnectionsZone クラス

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

WebPart および WebPartZoneBase ゾーン内にある その他のサーバー コントロールの間でユーザー接続構成できるユーザー インターフェイス (UI) を提供します

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

Public Class ConnectionsZone
    Inherits ToolZone
Dim instance As ConnectionsZone
public class ConnectionsZone : ToolZone
public ref class ConnectionsZone : public
 ToolZone
public class ConnectionsZone extends ToolZone
public class ConnectionsZone extends
 ToolZone
解説解説

Web パーツ コントロール セット使用して2 つサーバー コントロール間で接続構成してデータ共有し1 つコントロールプロバイダとして機能させ、もう 1 つコントロールデータコンシューマとして機能させることができます2 つコントロールには、WebPart コントロールか、またはその他の任意の種類サーバー コントロール指定できます。ただし、それらが接続処理するようにデザインされWebPartZoneBase ゾーン内にある必要がありますWeb パーツ接続詳細については、WebPartConnection クラス概要ConnectionPoint クラス概要、および「Web パーツ接続概要」を参照してください

Web パーツ接続必要なコントロール条件揃ったら、コントロール実際に接続する必要がありますサーバー コントロール間で接続構成する方法3 つありますWeb ページ接続宣言する方法コード接続作成する方法、および、ページConnectionsZone コントロール追加してユーザー必要に応じてコントロール接続できるようにする方法です。ConnectionsZone コントロールは、接続構成必要な条件満たしているページ上の任意のサーバー コントロールユーザー接続または接続解除できる UI生成します。このコントロール接続構成に必ずしも必要ではないオプションコントロールですが、接続または接続解除するサーバー コントロールユーザー制御できるようにする場合役立ちます

ConnectionsZone コントロールWeb パーツ ツール ゾーン コントロール1 つで、ToolZone 基本クラスから継承されます。ツール ゾーン1 つである ConnectionsZone コントロールは、Web ページ特定の表示モードになっている場合にのみ表示されるようにデザインされています。このような場合表示モードを、接続モード呼びます (ページ上の WebPartManager コントロールDisplayMode プロパティ値が ConnectDisplayMode に設定されている場合に、ページがこのモードなります)。ユーザーページ接続モード切り替え1 つサーバー コントロール動詞メニューConnect 動詞クリックすると、接続 UI表示されます。

Web パーツ ゾーン コントロール1 つである ConnectionsZone コントロールは、WebZone ゾーン (CompositeControl クラスから継承されます) の一種で、他のコントロール格納するようにデザインされています。一般にConnectionsZone ゾーンには、ヘッダー本体 (コンテンツ領域)、フッターなど、他の Web パーツ ツール ゾーン含まれる要素大部分含まれます。Web パーツ ゾーンの定義と、ゾーン含まれるさまざまな部分詳細については、WebZone クラス概要参照してください

メモ重要 :

他の Web パーツ ゾーンとは異なりConnectionsZone ゾーンは、それに関連付けられた一意種類サーバー コントロール格納しません。ゾーンおよびそれに格納される関連付けられたコントロール一覧については、WebZone クラス概要の表を参照してくださいConnectionsZone ゾーンは、WebPartConnection コントロール格納しません。その代わりに、ページ上の特定の WebPartZoneBase ゾーン内にあるサーバー コントロールユーザー接続または接続解除できる UI提供するという、非常に限定され用途使用されます。ConnectionsZone コントロール格納される唯一のコントロールは、接続構成する UI一部としてコントロール生成する標準 ASP.NET サーバー コントロールです。

ConnectionsZone コントロールは、レンダリング時に接続構成できるページ上のサーバー コントロール基づいて UI生成しますConnectionsZone コントロールは、ページ上の WebPartZoneBase ゾーンにあるサーバー コントロールのどれがプロバイダでどれがコンシューマか、どのコネクション ポイント使用できるか、および、サーバー コントロールが現在接続されているかまたは接続解除されているかを判断し、それに基づいて UI生成します

たとえば、プロバイダとして機能する 1 つWebPart コントロールコンシューマとして機能する 1 つWebPart コントロール存在し、それらがページ上の WebPartZone で宣言されていて、現在は接続解除されているとしますユーザーページ接続モード切り替え1 つコントロールConnect 動詞クリックすると、リンクを含んだ UIConnectionsZone コントロールによって生成されます。このリンクをクリックすると、接続作成するオプションユーザー選択できるフォーム表示されます (コントロール接続済み場合は、代わりにコントロール接続解除するボタン含んだ初期ビュー表示されます)。新し接続作成する接続 UI には、どちらのコントロールプロバイダで、どちらのコントロールコンシューマであるかが表示されます。それぞれのサーバー コントロールの下には、そのコントロール使用できる ConnectionPoint オブジェクトの一覧を表示したドロップダウン リスト コントロール表示されます。ユーザーは、それぞれのドロップダウン リストから、プロバイダでは ProviderConnectionPoint オブジェクト1 つ (コンシューマ共有するインターフェイスおよびデータ決定)、プロバイダ接続されるコンシューマでは ConsumerConnectionPoint オブジェクト1 つ (そのコンシューマ使用するインターフェイスデータ決定)、選択する必要があります

ConnectionsZone コントロール使用するには、このコントロールWeb ページ上の (他の Web パーツ ゾーン要素入れ子になっていない) <form> 要素内で <asp:connectionszone> 要素使用して宣言するか、またはプログラムによってページ追加しますページ内で <asp:connectionszone> 要素宣言する場合、他の Web パーツ ゾーンとは異なり、この要素タグ内で他の型のサーバー コントロール宣言することはできません。この要素自体プロパティおよびスタイル詳細に関す要素タグ内で宣言できますが、この要素スタンドアロン要素であり、要素内で他のサーバー コントロール宣言できるテンプレート コントロールではありません。

ConnectionsZone コントロールには、接続 UI表示使用するプロパティ多数あります1 つプロパティ セットには、UIアクション実行する (接続に関してのみ使用される) 動詞 (ConfigureVerb、ConnectVerb、および DisconnectVerb) が含まれます。接続ゾーン UI 用に特別に使用される大きプロパティ セットは、UIさまざまな場所 (または、エラーが発生した場合などの特定の状況下) で表示される文字列 (ConfigureConnectionTitle、ConnectToConsumerInstructionText、ConnectToConsumerText、ConnectToConsumerTitle、ConnectToProviderInstructionText、ConnectToProviderText、ConnectToProviderTitle、ConsumersInstructionText、ConsumersTitle、ExistingConnectionErrorMessage、GetFromText、GetText、InstructionTitle、NewConnectionErrorMessage、NoExistingConnectionInstructionText、NoExistingConnectionTitle、ProvidersInstructionText、ProvidersTitle、SendText、および SendToText) で構成されます。さらに、ConnectionsZone クラスには、他の Web パーツ ゾーン持っている共通のプロパティ (CancelVerb、CloseVerb、Display、EmptyZoneText、HeaderText、InstructionText、および PartChromeType) も含まれています。また、WebPartToConnect プロパティはこのクラス固有のプロパティであり、接続開始するコントロール (ユーザー動詞メニューConnect 動詞クリックする対象コントロールで、WebPartManager コントロールの SelectedWebPart プロパティ参照されるコントロール) を参照します。

ConnectionsZone クラスはいくつかのメソッド持ってます。それらはすべて基本クラスから継承されオーバーライドされ、大部分Web パーツ ゾーン基本クラスから派生します。詳細については、個々メソッドトピック参照してください

継承時の注意 開発者ConnectionsZone クラス動作変更したり、このクラス接続の処理用に用意されている既定UI変更したりする場合は、このクラス拡張できます

使用例使用例

Web パーツ ページ上で ConnectionsZone コントロール使用する方法次のコード例示します。この例は、4 つ部分構成されます。

コード例最初部分は、ユーザーWeb ページ上の表示モード切り替えられるようにするユーザー コントロールです。表示モード詳細、およびこのコントロールソース コード説明については、「チュートリアル : Web パーツ ページでの表示モード変更」を参照してください

<%@ control language="vb" classname="DisplayModeMenuVB"%>
<script runat="server">
  ' Use a field to reference the current WebPartManager.
  Dim _manager As WebPartManager

  Sub Page_Init(ByVal sender As
 Object, ByVal e As EventArgs)
    AddHandler Page.InitComplete, AddressOf
 InitComplete
  End Sub

  Sub InitComplete(ByVal sender As
 Object, ByVal e As System.EventArgs)
    _manager = WebPartManager.GetCurrentWebPartManager(Page)
      
    Dim browseModeName As String
 = WebPartManager.BrowseDisplayMode.Name
      
    ' Fill the dropdown with the names of supported display modes.
    Dim mode As WebPartDisplayMode
    For Each mode In _manager.SupportedDisplayModes
      Dim modeName As String
 = mode.Name
      ' Make sure a mode is enabled before adding it.
      If mode.IsEnabled(_manager) Then
        Dim item As New
 ListItem(modeName, modeName)
        DisplayModeDropdown.Items.Add(item)
      End If
    Next mode
      
    ' If shared scope is allowed for this user, display the scope-switching
    ' UI and select the appropriate radio button for the current user
 scope.
    If _manager.Personalization.CanEnterSharedScope Then
      Panel2.Visible = True
      If _manager.Personalization.Scope = PersonalizationScope.User
 Then
        RadioButton1.Checked = True
      Else
        RadioButton2.Checked = True
      End If
    End If
   
  End Sub

  ' Change the page to the selected display mode.
  Sub DisplayModeDropdown_SelectedIndexChanged(ByVal
 sender As Object, _
    ByVal e As EventArgs)
    
    Dim selectedMode As String
 = DisplayModeDropdown.SelectedValue   
    Dim mode As WebPartDisplayMode = _
      _manager.SupportedDisplayModes(selectedMode)
    If Not (mode Is Nothing)
 Then
      _manager.DisplayMode = mode
    End If

  End Sub
   
  ' Set the selected item equal to the current display mode.
  Sub Page_PreRender(ByVal sender As
 Object, ByVal e As EventArgs)
    Dim items As ListItemCollection = DisplayModeDropdown.Items
    Dim selectedIndex As Integer
 = _
      items.IndexOf(items.FindByText(_manager.DisplayMode.Name))
    DisplayModeDropdown.SelectedIndex = selectedIndex

  End Sub

  ' Reset all of a user's personalization data for the page.
  Protected Sub LinkButton1_Click(ByVal
 sender As Object, _
    ByVal e As EventArgs)
    
    _manager.Personalization.ResetPersonalizationState()
    
  End Sub

  ' If not in User personalization scope, toggle into it.
  Protected Sub RadioButton1_CheckedChanged(ByVal
 sender As Object, _
    ByVal e As EventArgs)
    
    If _manager.Personalization.Scope = PersonalizationScope.Shared
 Then
      _manager.Personalization.ToggleScope()
    End If

  End Sub
   
  ' If not in Shared scope, and if user is allowed, toggle the scope.
  Protected Sub RadioButton2_CheckedChanged(ByVal
 sender As Object, _
    ByVal e As EventArgs)
    
    If _manager.Personalization.CanEnterSharedScope AndAlso
 _
      _manager.Personalization.Scope = PersonalizationScope.User Then
      _manager.Personalization.ToggleScope()
    End If

  End Sub

</script>
<div>
  <asp:Panel ID="Panel1" runat="server"
 
    Borderwidth="1" 
    Width="230" 
    BackColor="lightgray"
    Font-Names="Verdana, Arial, Sans Serif" >
    <asp:Label ID="Label1" runat="server"
 
      Text="&nbsp;Display Mode" 
      Font-Bold="true"
      Font-Size="8"
      Width="120" />
    <asp:DropDownList ID="DisplayModeDropdown"
 runat="server"  
      AutoPostBack="true" 
      Width="120"
      OnSelectedIndexChanged="DisplayModeDropdown_SelectedIndexChanged"
 />
    <asp:LinkButton ID="LinkButton1" runat="server"
      Text="Reset User State" 
      ToolTip="Reset the current user's personalization data for
 the page."
      Font-Size="8" 
      OnClick="LinkButton1_Click" />
    <asp:Panel ID="Panel2" runat="server"
 
      GroupingText="Personalization Scope"
      Font-Bold="true"
      Font-Size="8" 
      Visible="false" >
      <asp:RadioButton ID="RadioButton1" runat="server"
 
        Text="User" 
        AutoPostBack="true"
        GroupName="Scope" OnCheckedChanged="RadioButton1_CheckedChanged"
 />
      <asp:RadioButton ID="RadioButton2" runat="server"
 
        Text="Shared" 
        AutoPostBack="true"
        GroupName="Scope" 
        OnCheckedChanged="RadioButton2_CheckedChanged"
 />
    </asp:Panel>
  </asp:Panel>
</div>
<%@ control language="C#" classname="DisplayModeMenuCS"%>
<script runat="server">
  
 // Use a field to reference the current WebPartManager.
  WebPartManager _manager;

  void Page_Init(object sender, EventArgs e)
  {
    Page.InitComplete += new EventHandler(InitComplete);
  }  

  void InitComplete(object sender, System.EventArgs e)
  {
    _manager = WebPartManager.GetCurrentWebPartManager(Page);

    String browseModeName = WebPartManager.BrowseDisplayMode.Name;

    // Fill the dropdown with the names of supported display modes.
    foreach (WebPartDisplayMode mode in _manager.SupportedDisplayModes)
    {
      String modeName = mode.Name;
      // Make sure a mode is enabled before adding it.
      if (mode.IsEnabled(_manager))
      {
        ListItem item = new ListItem(modeName, modeName);
        DisplayModeDropdown.Items.Add(item);
      }
    }

    // If shared scope is allowed for this user, display the scope-switching
    // UI and select the appropriate radio button for the current user
 scope.
    if (_manager.Personalization.CanEnterSharedScope)
    {
      Panel2.Visible = true;
      if (_manager.Personalization.Scope == PersonalizationScope.User)
        RadioButton1.Checked = true;
      else
        RadioButton2.Checked = true;
    }
    
  }
 
  // Change the page to the selected display mode.
  void DisplayModeDropdown_SelectedIndexChanged(object sender,
 EventArgs e)
  {
    String selectedMode = DisplayModeDropdown.SelectedValue;

    WebPartDisplayMode mode = _manager.SupportedDisplayModes[selectedMode];
    if (mode != null)
      _manager.DisplayMode = mode;
  }

  // Set the selected item equal to the current display mode.
  void Page_PreRender(object sender, EventArgs e)
  {
    ListItemCollection items = DisplayModeDropdown.Items;
    int selectedIndex = 
      items.IndexOf(items.FindByText(_manager.DisplayMode.Name));
    DisplayModeDropdown.SelectedIndex = selectedIndex;
  }

  // Reset all of a user's personalization data for the page.
  protected void LinkButton1_Click(object sender,
 EventArgs e)
  {
    _manager.Personalization.ResetPersonalizationState();
  }

  // If not in User personalization scope, toggle into it.
  protected void RadioButton1_CheckedChanged(object
 sender, EventArgs e)
  {
    if (_manager.Personalization.Scope == PersonalizationScope.Shared)
      _manager.Personalization.ToggleScope();
  }

  // If not in Shared scope, and if user is allowed, toggle the scope.
  protected void RadioButton2_CheckedChanged(object
 sender, EventArgs e)
  {
    if (_manager.Personalization.CanEnterSharedScope &&
 
        _manager.Personalization.Scope == PersonalizationScope.User)
      _manager.Personalization.ToggleScope();
  }
</script>
<div>
  <asp:Panel ID="Panel1" runat="server" 
    Borderwidth="1" 
    Width="230" 
    BackColor="lightgray"
    Font-Names="Verdana, Arial, Sans Serif" >
    <asp:Label ID="Label1" runat="server" 
      Text="&nbsp;Display Mode" 
      Font-Bold="true"
      Font-Size="8"
      Width="120" />
    <asp:DropDownList ID="DisplayModeDropdown" runat="server"
  
      AutoPostBack="true" 
      Width="120"
      OnSelectedIndexChanged="DisplayModeDropdown_SelectedIndexChanged"
 />
    <asp:LinkButton ID="LinkButton1" runat="server"
      Text="Reset User State" 
      ToolTip="Reset the current user's personalization data for
 the page."
      Font-Size="8" 
      OnClick="LinkButton1_Click" />
    <asp:Panel ID="Panel2" runat="server" 
      GroupingText="Personalization Scope"
      Font-Bold="true"
      Font-Size="8" 
      Visible="false" >
      <asp:RadioButton ID="RadioButton1" runat="server" 
        Text="User" 
        AutoPostBack="true"
        GroupName="Scope" OnCheckedChanged="RadioButton1_CheckedChanged"
 />
      <asp:RadioButton ID="RadioButton2" runat="server" 
        Text="Shared" 
        AutoPostBack="true"
        GroupName="Scope" 
        OnCheckedChanged="RadioButton2_CheckedChanged" />
    </asp:Panel>
  </asp:Panel>
</div>

コード例2 番目の部分は、インターフェイスカスタム コントロール含んでいるソース ファイルです。ZipCodeWebPart コントロールIZipCode実装し、プロバイダとして機能できるように ConnectionProvider 属性追加してます。WeatherWebPart コントロールConnectionConsumer 属性マークされメソッド持ち、このメソッドIZipCode インターフェイス使用して接続コンシューマとして機能できます

コード例実行するためには、このソース コードコンパイルする必要があります。それを明示的にコンパイルし、コンパイル済みアセンブリWeb サイトBin フォルダまたはグローバル アセンブリ キャッシュ配置できますサイトの App_Code フォルダソース コード配置し実行時動的にコンパイルすることもできます。この例は、動的コンパイル使用しますコンパイル方法を示すチュートリアルについては、「チュートリアル : カスタム サーバー コントロール開発と使用」を参照してください

Imports System
Imports System.Web
Imports System.Web.Security
Imports System.Security.Permissions
Imports System.Web.UI
Imports System.Web.UI.WebControls
Imports System.Web.UI.WebControls.WebParts

Namespace Samples.AspNet.VB.Controls

  <AspNetHostingPermission(SecurityAction.Demand, _
    Level:=AspNetHostingPermissionLevel.Minimal)> _
  <AspNetHostingPermission(SecurityAction.InheritanceDemand, _
    Level:=AspNetHostingPermissionLevel.Minimal)> _
  Public Interface IZipCode

    Property ZipCode() As String

  End Interface

  <AspNetHostingPermission(SecurityAction.Demand, _
    Level:=AspNetHostingPermissionLevel.Minimal)> _
  <AspNetHostingPermission(SecurityAction.InheritanceDemand, _
    Level:=AspNetHostingPermissionLevel.Minimal)> _
  Public Class ZipCodeWebPart
    Inherits WebPart
    Implements IZipCode
    Private zipCodeText As String
 = String.Empty
    Private input As TextBox
    Private send As Button

    Public Sub New()
    End Sub

    ' Make the implemented property personalizable to save 
    ' the Zip Code between browser sessions.
    <Personalizable()> _
    Public Property ZipCode() As
 String _
      Implements IZipCode.ZipCode

      Get
        Return zipCodeText
      End Get
      Set(ByVal value As
 String)
        zipCodeText = value
      End Set
    End Property

    ' This is the callback method that returns the provider.
    <ConnectionProvider("Zip Code Provider", "ZipCodeProvider")>
 _
    Public Function ProvideIZipCode() As
 IZipCode
      Return Me
    End Function


    Protected Overrides Sub
 CreateChildControls()
      Controls.Clear()
      input = New TextBox()
      Me.Controls.Add(input)
      send = New Button()
      send.Text = "Enter 5-digit Zip Code"
      AddHandler send.Click, AddressOf Me.submit_Click
      Me.Controls.Add(send)

    End Sub


    Private Sub submit_Click(ByVal
 sender As Object, _
      ByVal e As EventArgs)

      If input.Text <> String.Empty Then
        zipCodeText = Page.Server.HtmlEncode(input.Text)
        input.Text = String.Empty
      End If

    End Sub

  End Class

  <AspNetHostingPermission(SecurityAction.Demand, _
    Level:=AspNetHostingPermissionLevel.Minimal)> _
  <AspNetHostingPermission(SecurityAction.InheritanceDemand, _
    Level:=AspNetHostingPermissionLevel.Minimal)> _
  Public Class WeatherWebPart
    Inherits WebPart
    Private _provider As IZipCode
    Private _zipSearch As String
    Private DisplayContent As Label

    ' This method is identified by the ConnectionConsumer 
    ' attribute, and is the mechanism for connecting with 
    ' the provider. 
    <ConnectionConsumer("Zip Code Consumer", "ZipCodeConsumer")>
 _
    Public Sub GetIZipCode(ByVal
 Provider As IZipCode)
      _provider = Provider
    End Sub


    Protected Overrides Sub
 OnPreRender(ByVal e As EventArgs)
      EnsureChildControls()

      If Not (Me._provider
 Is Nothing) Then
        _zipSearch = _provider.ZipCode.Trim()
                DisplayContent.Text = "My Zip Code is:  "
 + _zipSearch
      End If

    End Sub 'OnPreRender

    Protected Overrides Sub
 CreateChildControls()
      Controls.Clear()
      DisplayContent = New Label()
      Me.Controls.Add(DisplayContent)

    End Sub

  End Class

End Namespace
namespace Samples.AspNet.CS.Controls
{
  using System;
  using System.Web;
  using System.Web.Security;
  using System.Security.Permissions;
  using System.Web.UI;
  using System.Web.UI.WebControls;
  using System.Web.UI.WebControls.WebParts;

  [AspNetHostingPermission(SecurityAction.Demand,
    Level = AspNetHostingPermissionLevel.Minimal)]
  [AspNetHostingPermission(SecurityAction.InheritanceDemand,
    Level = AspNetHostingPermissionLevel.Minimal)]
  public interface IZipCode
  {
    string ZipCode { get; set;}
  }

  [AspNetHostingPermission(SecurityAction.Demand,
    Level = AspNetHostingPermissionLevel.Minimal)]
  [AspNetHostingPermission(SecurityAction.InheritanceDemand,
    Level = AspNetHostingPermissionLevel.Minimal)]
  public class ZipCodeWebPart : WebPart, IZipCode
  {
    string zipCodeText = String.Empty;
    TextBox input;
    Button send;

    public ZipCodeWebPart()
    {
    }

    // Make the implemented property personalizable to save 
    // the Zip Code between browser sessions.
    [Personalizable()]
    public virtual string ZipCode
    {
      get { return zipCodeText; }
      set { zipCodeText = value; }
    }

    // This is the callback method that returns the provider.
    [ConnectionProvider("Zip Code Provider", "ZipCodeProvider")]
    public IZipCode ProvideIZipCode()
    {
      return this;
    }

    protected override void CreateChildControls()
    {
      Controls.Clear();
      input = new TextBox();
      this.Controls.Add(input);
      send = new Button();
      send.Text = "Enter 5-digit Zip Code";
      send.Click += new EventHandler(this.submit_Click);
      this.Controls.Add(send);
    }

    private void submit_Click(object sender,
 EventArgs e)
    {
      if (input.Text != String.Empty)
      {
        zipCodeText = Page.Server.HtmlEncode(input.Text);
        input.Text = String.Empty;
      }
    }

  }

  [AspNetHostingPermission(SecurityAction.Demand,
    Level = AspNetHostingPermissionLevel.Minimal)]
  [AspNetHostingPermission(SecurityAction.InheritanceDemand,
    Level = AspNetHostingPermissionLevel.Minimal)]
  public class WeatherWebPart : WebPart
  {
    private IZipCode _provider;
    string _zipSearch;
    Label DisplayContent;

    // This method is identified by the ConnectionConsumer 
    // attribute, and is the mechanism for connecting with 
    // the provider. 
    [ConnectionConsumer("Zip Code Consumer", "ZipCodeConsumer")]
    public void GetIZipCode(IZipCode Provider)
    {
      _provider = Provider;
    }
    
    protected override void OnPreRender(EventArgs
 e)
    {
      EnsureChildControls();

      if (this._provider != null)
      {
        _zipSearch = _provider.ZipCode.Trim();
        DisplayContent.Text = "My Zip Code is:  " + _zipSearch;
      }
    }

    protected override void CreateChildControls()
    {
      Controls.Clear();
      DisplayContent = new Label();
      this.Controls.Add(DisplayContent);
    }

  }
}

プログラム例3 番目の部分Web ページです。先頭近くに、接続使用されるユーザー コントロールカスタム コントロールRegister ディレクティブあります宣言によって ConnectionsZone コントロール使用する例として、<asp:connectionszone> 要素ページ宣言されています。この要素内で、いくつかのプロパティ宣言によって設定されています。接続ゾーンその他のプロパティは、ページ<script> セクション内でプログラムによって設定されています。

<%@ Page Language="VB" %>
<%@ register tagprefix="uc1" 
    tagname="DisplayModeMenuVB"
    src="~/displaymodemenuvb.ascx" %>
<%@ Register TagPrefix="aspSample" 
    Namespace="Samples.AspNet.VB.Controls"
 %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML
 1.0 Transitional//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

  Protected Sub Page_PreRender(ByVal
 sender As Object, _
    ByVal e As System.EventArgs)
    
    ' Set properties for verbs.
    connectionsZone1.CancelVerb.Description = _
      "Terminates the connection process"
    connectionsZone1.CloseVerb.Description = _
      "Closes the connections UI"
    connectionsZone1.ConfigureVerb.Description = _
      "Configure the transformer for the connection"
    connectionsZone1.ConnectVerb.Description = _
      "Connect two WebPart controls"
    connectionsZone1.DisconnectVerb.Description = _
      "End the connection between two controls"
    
    ' Set properties for UI text strings.
    connectionsZone1.ConfigureConnectionTitle = _
      "Configure a new connection"
    connectionsZone1.ConnectToConsumerInstructionText = _
      "Choose a consumer connection point"
    connectionsZone1.ConnectToConsumerText = _
      "Select a consumer for the provider to connect with"
    connectionsZone1.ConnectToConsumerTitle = _
      "Send data to this consumer"
    connectionsZone1.ConnectToProviderInstructionText = _
      "Choose a provider connection point"
    connectionsZone1.ConnectToProviderText = _
      "Select a provider for the consumer to connect with"
    connectionsZone1.ConnectToProviderTitle = _
      "Get data from this provider"
    connectionsZone1.ConsumersInstructionText = _
      "WebPart controls that receive data from providers"
    connectionsZone1.ConsumersTitle = "Consumer Controls"
    connectionsZone1.GetFromText = "Receive from"
    connectionsZone1.GetText = "Retrieve"
    connectionsZone1.HeaderText = _
      "Create and Manage Connections"
    connectionsZone1.InstructionText = _
      "Manage connections for the selected WebPart control"
    connectionsZone1.InstructionTitle = _
      "Manage connections for consumers or providers"
    connectionsZone1.NoExistingConnectionInstructionText = _
      "No connections exist. Click the above link to create "
 _
      & "a connection."
    connectionsZone1.NoExistingConnectionTitle = _
      "No current connections"
    connectionsZone1.ProvidersInstructionText = _
      "WebPart controls that send data to consumers"
    connectionsZone1.ProvidersTitle = "Provider controls"

  End Sub

</script>

<html  >
<head runat="server">
    <title>Connection Zone Sample</title>
</head>
<body>
  <form id="form1" runat="server">
  <asp:webpartmanager runat="server" id="mgr">
    <staticconnections>
      <asp:webpartconnection id="connection1" 
        consumerconnectionpointid="ZipCodeConsumer"
        consumerid="zipConsumer"
        providerconnectionpointid="ZipCodeProvider"
 
        providerid="zipProvider" />
    </staticconnections>
  </asp:webpartmanager>
  <uc1:displaymodemenuvb id="menu1" runat="server"
 />
  <div>
  <asp:webpartzone id="WebPartZone1" 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>
  <asp:connectionszone id="connectionsZone1" runat="server"
 >
    <cancelverb text="Terminate" />
    <closeverb text="Close Zone" />
    <configureverb text="Configure" />
    <connectverb text="Connect Controls" />
    <disconnectverb text="End Connection" />
  </asp:connectionszone>
  </div>
  </form>
</body>
</html>
<%@ Page Language="C#" %>
<%@ register tagprefix="uc1" 
    tagname="DisplayModeMenuCS"
    src="~/displaymodemenucs.ascx" %>
<%@ Register TagPrefix="aspSample" 
    Namespace="Samples.AspNet.CS.Controls" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<script runat="server">

  protected void Page_PreRender(object sender,
 EventArgs e)
  {
     // Set properties on verbs.
     connectionsZone1.CancelVerb.Description = 
       "Terminates the connection process";
     connectionsZone1.CloseVerb.Description = 
       "Closes the connections UI";
     connectionsZone1.ConfigureVerb.Description =
       "Configure the transformer for the connection";
     connectionsZone1.ConnectVerb.Description =
       "Connect two WebPart controls";
     connectionsZone1.DisconnectVerb.Description =
       "End the connection between two controls";
    
     // Set properties for UI text strings.
     connectionsZone1.ConfigureConnectionTitle = 
       "Configure";
     connectionsZone1.ConnectToConsumerInstructionText = 
       "Choose a consumer connection point";
     connectionsZone1.ConnectToConsumerText = 
       "Select a consumer for the provider to connect with";
     connectionsZone1.ConnectToConsumerTitle = 
       "Send data to this consumer";
     connectionsZone1.ConnectToProviderInstructionText =
       "Choose a provider connection point";
     connectionsZone1.ConnectToProviderText =
       "Select a provider for the consumer to connect with";
     connectionsZone1.ConnectToProviderTitle =
       "Get data from this provider";
     connectionsZone1.ConsumersInstructionText = 
       "WebPart controls that receive data from providers";
     connectionsZone1.ConsumersTitle = "Consumer Controls";
     connectionsZone1.GetFromText = "Receive from";
     connectionsZone1.GetText = "Retrieve";
     connectionsZone1.HeaderText = 
      "Create and Manage Connections";
     connectionsZone1.InstructionText = 
      "Manage connections for the selected WebPart control";
     connectionsZone1.InstructionTitle = 
       "Manage connections for consumers or providers";
     connectionsZone1.NoExistingConnectionInstructionText = 
       "No connections exist. Click the above link to create "
       + "a connection.";
     connectionsZone1.NoExistingConnectionTitle = 
       "No current connections";
     connectionsZone1.ProvidersInstructionText =
       "WebPart controls that send data to consumers";
     connectionsZone1.ProvidersTitle = "Provider controls";
     
  }
</script>

<html  >
<head runat="server">
    <title>Connection Zone Sample</title>
</head>
<body>
  <form id="form1" runat="server">
  <asp:webpartmanager runat="server" id="mgr">
    <staticconnections>
      <asp:webpartconnection id="connection1" 
        consumerconnectionpointid="ZipCodeConsumer"
        consumerid="zipConsumer"
        providerconnectionpointid="ZipCodeProvider" 
        providerid="zipProvider" />
    </staticconnections>
  </asp:webpartmanager>
  <uc1:displaymodemenucs id="menu1" runat="server" />
  <div>
  <asp:webpartzone id="WebPartZone1" 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>
  <asp:connectionszone id="connectionsZone1" runat="server"
 >
    <cancelverb text="Terminate" />
    <closeverb text="Close Zone" />
    <configureverb text="Configure" />
    <connectverb text="Connect Controls" />
    <disconnectverb text="End Connection" />
  </asp:connectionszone>
  </div>
  </form>
</body>
</html>

ブラウザWeb ページ読み込みます。[表示モード] ドロップダウン リスト コントロール使用してページ接続モード切り替えます。[ZIP Code Provider] コントロール動詞メニュー (コントロールタイトル バー下向き矢印表示) で、Connect 動詞クリックします。ConnectionsZone コントロール表示されます。接続 UI に [End Connection] が表示されていることに注意してくださいページマークアップ接続宣言されているため、コントロールは既に接続されています。[End Connection] をクリックし、再び [表示モード] コントロール使用してページブラウズ モード戻します次にページを再び接続モード戻し1 つコントロールConnect 動詞クリックすると、コントロールの間の接続構成できるハイパーリンクUI表示されます。リンクをクリックし接続 UIコネクション ポイント選択して接続確立します。

.NET Framework のセキュリティ.NET Frameworkセキュリティ
継承階層継承階層
System.Object
   System.Web.UI.Control
     System.Web.UI.WebControls.WebControl
       System.Web.UI.WebControls.CompositeControl
         System.Web.UI.WebControls.WebParts.WebZone
           System.Web.UI.WebControls.WebParts.ToolZone
            System.Web.UI.WebControls.WebParts.ConnectionsZone
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ConnectionsZone メンバ
System.Web.UI.WebControls.WebParts 名前空間
WebZone
WebPartConnection
ConnectionPoint クラス
WebPartZoneBase
その他の技術情報
ASP.NET Web パーツ ページ
Web パーツ接続概要


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

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

辞書ショートカット

すべての辞書の索引

「ConnectionsZone クラス」の関連用語

ConnectionsZone クラスのお隣キーワード
検索ランキング

   

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



ConnectionsZone クラスのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2024 GRAS Group, Inc.RSS