ConnectionsZone.InstructionText Свойство

Определение

Получает или задает текст, который используется для общих инструкций о выбранном элементе управления в разделе пользовательского интерфейса подключения для управления существующими подключениями.

public:
 virtual property System::String ^ InstructionText { System::String ^ get(); void set(System::String ^ value); };
public override string InstructionText { get; set; }
member this.InstructionText : string with get, set
Public Overrides Property InstructionText As String

Значение свойства

String

Строка, содержащая текст инструкции для пользовательского интерфейса подключения. Используемым по умолчанию текстом является соответствующая конкретному языку строка, которую предоставляет платформа .NET Framework.

Примеры

В следующем примере кода показано использование InstructionText свойства с элементом ConnectionsZone управления. В примере содержится только код веб-страницы, демонстрирующий использование свойства; сведения о двух других файлах кода, необходимых для запуска примера, см. в ConnectionsZone разделе "Пример" обзора класса. Пример кода состоит из четырех частей:

  • Пользовательский элемент управления, позволяющий переключать режимы отображения на веб-странице. Получите этот код из ConnectionsZone обзора класса.

  • Исходный файл, содержащий код для интерфейса ZIP-кода, и два WebPart элемента управления, действующие в качестве поставщика и потребителя для подключения. Получите этот код из ConnectionsZone обзора класса.

  • Веб-страница, на котором размещены все элементы управления, объявляет <asp:connectionszone> элемент и показывает, как использовать свойство программным способом.

  • Объяснение того, как работает пример в браузере.

Веб-страница объявляет <asp:connectionszone> элемент и в методе Page_PreRender код присваивает свойству InstructionText значение.

<%@ 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>

Загрузите страницу в браузере. Переключитесь в режим подключения с помощью элемента управления "Режим отображения ". Щелкните стрелку меню команд в элементе управления "Получатель ПОЧТОВОго кода " и щелкните команду connect. В представлении, открываемом для существующего подключения, обратите внимание, что текст инструкции в верхней части зоны подключений является значением, назначенным свойству InstructionText в примере кода.

Комментарии

Текст, содержащийся в свойстве InstructionText , отображается при отображении пользовательского интерфейса подключения и уже существует соединение. Непосредственно под текстом заголовка (содержащимся в HeaderText свойстве), который находится в верхней части пользовательского интерфейса подключения, — это заголовок инструкции, который находится под текстом инструкции. Текст инструкции сообщает пользователям, какой тип действия можно выполнить в выбранном WebPart элементе управления (выбранный элемент управления — это тот, для которого пользователь щелкнул команду подключения в меню команд элемента управления). По умолчанию текст инструкции — управление подключениями для текущей веб-части.

Это свойство переопределяет базовое InstructionText свойство из класса, чтобы текст инструкции ToolZone зоны подключений по умолчанию можно было назначить свойству.

Значение этого свойства можно задать декларативно в открываемом теге <asp:connectionszone> элемента, добавив атрибут с именем InstructionText и назначив его значение. Можно также задать значение свойства программным способом.

Применяется к

См. также раздел