ConnectionsZone.DisconnectVerb 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取一个对 WebPartVerb 对象的引用,该对象使用户可以使两个连接的 WebPart 控件断开连接。
public:
virtual property System::Web::UI::WebControls::WebParts::WebPartVerb ^ DisconnectVerb { System::Web::UI::WebControls::WebParts::WebPartVerb ^ get(); };
[System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)]
public virtual System.Web.UI.WebControls.WebParts.WebPartVerb DisconnectVerb { get; }
[<System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)>]
member this.DisconnectVerb : System.Web.UI.WebControls.WebParts.WebPartVerb
Public Overridable ReadOnly Property DisconnectVerb As WebPartVerb
属性值
一个 WebPartVerb,使两个连接的 WebPart 控件断开连接。
- 属性
示例
下面的代码示例演示如何将 DisconnectVerb 属性与 控件一 ConnectionsZone 起使用。 该示例仅包含演示如何使用 属性的网页的代码;有关运行示例所需的其他两个代码文件,请参阅类概述的 ConnectionsZone “示例”部分。 该代码示例包含四个部分:
一个用户控件,可用于切换网页上的显示模式。 从类概述中 ConnectionsZone 获取此代码。
一个源文件,其中包含邮政编码接口的代码,以及充当连接的提供程序和使用者的两 WebPart 个控件。 从类概述中 ConnectionsZone 获取此代码。
承载所有控件、声明
<asp:connectionszone>
元素并演示如何以声明方式和编程方式使用 属性的网页。说明示例在浏览器中的工作原理。
网页声明元素 <asp:connectionszone>
,并在元素标记中声明 <disconnectverb>
元素并使用 属性设置一些属性。 此外,在 方法中 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>
在浏览器中加载页面。 使用显示模式控件切换到连接 模式 。 单击 邮政编码提供程序 控件上的谓词菜单箭头,然后单击连接谓词。 请注意在断开连接谓词上设置的属性值的效果。 如果将鼠标指针放在“ 结束连接 ”按钮上,自定义说明文本将显示在工具提示中。 单击“ 结束连接 ”按钮,断开由于页面上的声明性连接而已连接的控件。
注解
与 控件一起使用的 ConnectionsZone disconnect 谓词是一个区域级谓词,显示在连接用户界面 (UI) 中,作为用户管理两个控件之间现有连接的视图的一部分。 用户单击 WebPart 控件谓词菜单上的连接谓词后,连接 UI 显示,如果两个控件之间已有连接,则断开连接谓词显示在 UI 底部附近激活。
DisconnectVerb使用 属性获取对 UI 中相应WebPartVerb对象的引用。 尽管属性本身是只读的,但在你拥有对谓词的引用后,可以根据需要更改其属性值。
可以通过声明元素的开始标记和结束标记之间的 元素, <disconnectverb>
以声明方式设置断开连接谓词的 <asp:connectionszone>
属性值。 动词的属性也可以在元素的 <asp:connectionszone>
开始标记中以声明方式设置,方法是以 的形式 Property-Subproperty
添加属性,其中 Subproperty
是 对象的属性 WebPartVerb , (例如 DisconnectVerb-Text
,) 。 还可以以编程方式在窗体 Property.Subproperty
中设置属性, (例如 DisconnectVerb.Text
,) 。