ConnectionsZone.GetText 属性
定义
获取或设置文本,该文本在连接用户界面 (UI) 中位于指定的使用者(该使用者将从提供者检索数据)之前的那部分中显示。Gets or sets the text shown in the section of the connection user interface (UI) that precedes the named consumer that will receive data from a provider.
public:
virtual property System::String ^ GetText { System::String ^ get(); void set(System::String ^ value); };
public virtual string GetText { get; set; }
member this.GetText : string with get, set
Public Overridable Property GetText As String
属性值
一个字符串,位于连接中的指定使用者之前。A string that prefaces the named consumer in the connection. 默认文本是一个由 .NET Framework 提供的、特定于区域性的字符串。The default text is a culture-specific string supplied by the .NET Framework.
示例
下面的代码示例演示如何将属性用于 GetText ConnectionsZone 控件。The following code example demonstrates the use of the GetText property with a ConnectionsZone control. 此示例仅包含演示属性使用的网页代码;对于运行此示例所需的其他两个代码文件,请参见类概述的 "示例" 部分 ConnectionsZone 。The example contains only the code for the Web page that demonstrates use of the property; for the other two code files needed to run the example, see the Example section of the ConnectionsZone class overview. 此代码示例包含四个部分:The code example has four parts:
使您能够在网页上切换显示模式的用户控件。A user control that enables you to switch display modes on the Web page. 从类概述获取此代码 ConnectionsZone 。Obtain this code from the ConnectionsZone class overview.
一个源文件,其中包含邮政编码接口的代码,以及两个控件, WebPart 用作连接的提供者和使用者。A source file that contains the code for a ZIP Code interface, and two WebPart controls acting as the provider and the consumer for a connection. 从类概述获取此代码 ConnectionsZone 。Obtain this code from the ConnectionsZone class overview.
承载所有控件、声明
<asp:connectionszone>元素并演示如何以编程方式使用属性的网页。A Web page that hosts all the controls, declares an<asp:connectionszone>element, and shows how to use the property programmatically.说明如何在浏览器中工作。An explanation of how the example works in a browser.
网页声明一个元素, <asp:connectionszone> 并在 Page_PreRender 方法中为该属性分配一个值 GetText 。The Web page declares an <asp:connectionszone> element and, in the Page_PreRender method, the code assigns a value to the GetText property.
<%@ 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>
在浏览器中加载页面。Load the page in a browser. 使用 " 显示模式 " 控件切换到 "连接" 模式。Switch to connect mode, using the Display Mode control. 单击 邮政编码使用者 控件上的谓词菜单箭头,然后单击 "连接" 谓词。Click the verbs menu arrow on the ZIP Code Consumer control, and click the connect verb. 在为现有连接打开的视图中,在 "提供程序" 部分中查找指定的使用者之前的文本。In the view that opens for the existing connection, look in the providers section for the text that precedes the named consumer. 这是分配给属性的文本 GetText 。This is the text assigned to the GetText property.
注解
GetText属性在特定连接方案中生效。The GetText property takes effect in a specific connection scenario. 当用户在使用者控件上单击连接谓词时, ConnectionsZone 控件将显示一个视图,该视图使用户能够与提供程序建立连接。When a user clicks the connect verb on a consumer control, the ConnectionsZone control displays a view that enables users to establish a connection to a provider. 在指示用户选择提供者连接点的 UI 部分中,有一些文本位于将参与连接的命名使用者之前。In the part of the UI that instructs users to choose a provider connection point, there is some text that precedes the named consumer that will participate in the connection. 使用者前面的文本是属性中的文本 GetText 。This text that precedes the consumer is the text in the GetText property. 默认情况下,文本值为 Get。By default, the text value is Get.
可以 <asp:connectionszone> 通过添加一个名为的属性 GetText 并为其分配一个值,在元素的开始标记中以声明方式设置此属性的值。You can set the value of this property declaratively within the opening tag of the <asp:connectionszone> element, by adding an attribute named GetText and assigning it a value. 还可以通过编程方式设置属性值。You can also set the property value programmatically.