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,用于打开连接用户界面中的“配置连接”部分。

属性

示例

下面的代码示例演示如何将 ConfigureVerb 属性与 控件一 ConnectionsZone 起使用。 该示例仅包含演示如何使用 属性的网页的代码;有关运行示例所需的其他两个代码文件,请参阅类概述的 ConnectionsZone “示例”部分。 该代码示例包含四个部分:

  • 一个用户控件,可用于切换网页上的显示模式。 从类概述中 ConnectionsZone 获取此代码。

  • 一个源文件,其中包含邮政编码接口的代码,以及充当连接的提供程序和使用者的两 WebPart 个控件。 从类概述中 ConnectionsZone 获取此代码。

  • 承载所有控件、声明 <asp:connectionszone> 元素并演示如何以声明方式和编程方式使用 属性的网页。

  • 说明示例在浏览器中的工作原理。

网页声明元素 <asp:connectionszone> ,在 元素内声明 <configureverb> 元素并使用 属性设置属性。 此外,在 方法中 Page_PreRender ,代码在 控件的配置谓词 ConnectionsZone 上设置 属性。

<%@ 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 ,) 。

适用于

另请参阅