ConnectionsZone.DisconnectVerb Propiedad

Definición

Obtiene una referencia a un objeto WebPartVerb que permite a un usuario desconectar dos controles WebPart conectados.

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

Valor de propiedad

Un control WebPartVerb que desconecta dos controles WebPart conectados.

Atributos

Ejemplos

En el ejemplo de código siguiente se muestra el uso de la DisconnectVerb propiedad con un ConnectionsZone control . El ejemplo contiene solo el código de la página web que muestra el uso de la propiedad ; para los otros dos archivos de código necesarios para ejecutar el ejemplo, vea la sección Ejemplo de la información general de la ConnectionsZone clase. El ejemplo de código tiene cuatro partes:

  • Control de usuario que permite cambiar los modos de visualización en la página web. Obtenga este código de la información general de la ConnectionsZone clase.

  • Un archivo de código fuente que contiene el código de una interfaz de código postal y dos WebPart controles que actúan como proveedor y consumidor para una conexión. Obtenga este código de la información general de la ConnectionsZone clase.

  • Una página web que hospeda todos los controles, declara un <asp:connectionszone> elemento y muestra cómo usar la propiedad mediante declaración y mediante programación.

  • Explicación de cómo funciona el ejemplo en un explorador.

La página web declara un <asp:connectionszone> elemento y, dentro de las etiquetas de elemento, declara un <disconnectverb> elemento y establece algunas propiedades mediante atributos. Además, en el Page_PreRender método , el código establece algunas propiedades en el verbo disconnect para el ConnectionsZone control .

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

Cargue la página en un explorador. Cambie al modo de conexión mediante el control Modo de visualización . Haga clic en la flecha del menú verbos en el control Proveedor de código postal y haga clic en el verbo conectar. Tenga en cuenta el efecto de los valores de propiedad establecidos en el verbo disconnect. Si coloca el puntero del mouse sobre el botón Finalizar conexión , el texto de descripción personalizado aparece en una información sobre herramientas. Haga clic en el botón Finalizar conexión para desconectar los controles que ya están conectados debido a la conexión declarativa en la página.

Comentarios

El verbo disconnect, como se usa con un ConnectionsZone control, es un verbo de nivel de zona que aparece en la interfaz de usuario (UI) de conexión como parte de la vista en la que los usuarios administran una conexión existente entre dos controles. Una vez que los usuarios han hecho clic en el WebPart verbo connect en el menú verbos de un control y aparece la interfaz de usuario de conexión, si ya hay una conexión entre dos controles, el verbo disconnect aparece activado cerca de la parte inferior de la interfaz de usuario.

Utilice la DisconnectVerb propiedad para obtener una referencia al objeto correspondiente WebPartVerb en la interfaz de usuario. Aunque la propia propiedad es de solo lectura, después de tener una referencia al verbo, puede cambiar sus valores de propiedad según sea necesario.

Puede establecer los valores de propiedad del verbo disconnect mediante declaración, declarando el <disconnectverb> elemento entre las etiquetas de apertura y cierre de un <asp:connectionszone> elemento. Las propiedades del verbo también se pueden establecer declarativamente dentro de la etiqueta de apertura del <asp:connectionszone> elemento agregando un atributo en el formulario Property-Subproperty, donde Subproperty es una propiedad del WebPartVerb objeto (por ejemplo, DisconnectVerb-Text). También puede establecer las propiedades mediante programación en el formulario Property.Subproperty (por ejemplo, DisconnectVerb.Text).

Se aplica a

Consulte también