ConnectionsZone.ConfigureVerb 屬性

定義

取得 WebPartVerb 物件的參考,這個物件是用來開啟連接使用者介面 (UI) 中的組態檢視。

public:
 virtual property System::Web::UI::WebControls::WebParts::WebPartVerb ^ ConfigureVerb { System::Web::UI::WebControls::WebParts::WebPartVerb ^ get(); };
[System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)]
public virtual System.Web.UI.WebControls.WebParts.WebPartVerb ConfigureVerb { get; }
[<System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)>]
member this.ConfigureVerb : System.Web.UI.WebControls.WebParts.WebPartVerb
Public Overridable ReadOnly Property ConfigureVerb As WebPartVerb

屬性值

WebPartVerb,用來開啟連接 UI 中的 [設定連接] 區段。

屬性

範例

下列程式碼範例示範搭配 控制項使用 ConfigureVerb 屬性 ConnectionsZone 。 此範例只包含示範使用 屬性之網頁的程式碼;如需執行範例所需的其他兩個程式碼檔案,請參閱類別概觀的 ConnectionsZone 範例一節。 程式碼範例有四個部分:

  • 使用者控制項,可讓您在網頁上切換顯示模式。 從類別概觀取得 ConnectionsZone 此程式碼。

  • 包含郵遞區號介面程式碼的來源檔案,以及兩 WebPart 個控制項做為連線的提供者和取用者。 從類別概觀取得 ConnectionsZone 此程式碼。

  • 裝載所有控制項的網頁、宣告 <asp:connectionszone> 專案,並示範如何以宣告方式和程式設計方式使用 屬性。

  • 說明範例如何在瀏覽器中運作。

網頁會 <asp:connectionszone> 宣告專案,並在 元素內宣告 <configureverb> 元素,並使用屬性來設定屬性。 此外,在 方法中 Page_PreRender ,程式碼會在 控制項的 ConnectionsZone configure verb 上設定 屬性。

<%@ 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 xmlns="http://www.w3.org/1999/xhtml" >
<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>
<%@ 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 xmlns="http://www.w3.org/1999/xhtml" >
<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>

在瀏覽器中載入頁面。 使用 顯示模式 控制項切換至連線模式。 按一下 [郵遞區號提供者 ] 控制項上的動詞功能表箭號,然後按一下 [連接動詞]。 請注意,有一個 [結束連接 ] 按鈕可中斷已連線的控制項,以及停用的 [ 設定 ] 按鈕。 如果您的程式碼範例使用包含設定精靈的轉換器,則會啟用 [ 設定 ] 按鈕,而且使用者可以按一下它來設定連線。 如果您將滑鼠指標放在連線 UI 中的 [ 設定 ] 按鈕上方,自訂描述文字會出現在工具提示中。

備註

設定動詞會出現在連線 UI 的 [管理連線] 區段中,當連線已存在且使用者已開啟連線 UI 時。 UI 會顯示使用者結束連線的 [結束 連線] 按鈕,而 [設定 ] 按鈕 ( 代表設定動詞) 設定連線。 如果使用者按一下 [ 設定 ] 按鈕,UI 的 [設定連線] 區段隨即出現,讓使用者能夠設定連線。 此選項可設定連線 (,因此只有在連線使用轉換器時,才會啟用 [設定 ] 按鈕) ,而轉換器會包含組態精靈控制項 (Wizard) ,讓使用者能夠加以設定。 如需詳細資訊,請參閱 WebPartTransformer 類別。

ConfigureVerb使用 屬性取得 UI 中對應 WebPartVerb 物件的參考。 雖然屬性本身是唯讀的,但在您有動詞的參考之後,您可以視需要變更其屬性值。

您可以宣告元素標籤內的 專案,以 <configureverb> 宣告動詞方式設定動詞的 <asp:connectionszone> 屬性值。 動詞的屬性可以宣告方式在 表單 Property-Subproperty 中設定,其中 Subproperty 是 物件的屬性 WebPartVerb (,例如, ConfigureVerb-Text) 。 您也可以在表單 Property.Subproperty 中以程式設計方式設定屬性 (,例如, ConfigureVerb.Text) 。

適用於

另請參閱