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 使用的中斷連接動詞是區域層級動詞,會顯示在連接使用者介面中, (UI) 作為檢視的一部分,讓使用者管理兩個控制項之間的現有連線。 當使用者在控制項的動詞功能表上按一下 WebPart [連接動詞] 動詞,且連線 UI 隨即出現,如果兩個控制項之間已經有連線,則會在 UI 底部附近啟動中斷連線動詞。
DisconnectVerb使用 屬性可取得 UI 中對應 WebPartVerb 物件的參考。 雖然屬性本身是唯讀的,但在您有動詞命令的參考之後,您可以視需要變更其屬性值。
您可以宣告專案開頭和結束記號 <asp:connectionszone>
之間的專案,以 <disconnectverb>
宣告中斷連接動詞的屬性值。 動詞命令的屬性也可以在元素的開頭標記 <asp:connectionszone>
內以宣告方式設定,方法是在 表單 Property-Subproperty
中加入 屬性,其中 Subproperty
是 (物件的屬性 WebPartVerb ,例如, DisconnectVerb-Text
) 。 您也可以以程式設計方式在表單 Property.Subproperty
中設定屬性,例如 () DisconnectVerb.Text
。