ConnectionsZone.DisconnectVerb Właściwość

Definicja

Pobiera odwołanie do WebPartVerb obiektu, który umożliwia użytkownikowi rozłączenie dwóch połączonych WebPart kontrolek.

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

Wartość właściwości

Element WebPartVerb , który rozłącza dwie połączone WebPart kontrolki.

Atrybuty

Przykłady

W poniższym przykładzie kodu pokazano użycie DisconnectVerb właściwości z kontrolką ConnectionsZone . Przykład zawiera tylko kod strony sieci Web, który demonstruje użycie właściwości ; w przypadku pozostałych dwóch plików kodu potrzebnych do uruchomienia przykładu zobacz sekcję Przykład w przeglądzie ConnectionsZone klasy. Przykładowy kod ma cztery części:

  • Kontrolka użytkownika, która umożliwia przełączanie trybów wyświetlania na stronie sieci Web. Uzyskaj ten kod z ConnectionsZone przeglądu klasy.

  • Plik źródłowy zawierający kod interfejsu kodu pocztowego i dwie WebPart kontrolki działające jako dostawca i odbiorca połączenia. Uzyskaj ten kod z ConnectionsZone przeglądu klasy.

  • Strona sieci Web, która hostuje <asp:connectionszone> wszystkie kontrolki, deklaruje element i pokazuje, jak deklaratywnie i programowo używać właściwości.

  • Wyjaśnienie działania przykładu w przeglądarce.

Strona sieci Web deklaruje <asp:connectionszone> element, a w ramach tagów elementów deklaruje <disconnectverb> element i ustawia niektóre właściwości przy użyciu atrybutów. Ponadto w metodzie Page_PreRender kod ustawia niektóre właściwości czasownika disconnect dla kontrolki 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>

Załaduj stronę w przeglądarce. Przełącz się do trybu łączenia przy użyciu kontrolki Tryb wyświetlania . Kliknij strzałkę menu czasowników w kontrolce Dostawca kodu pocztowego , a następnie kliknij czasownik connect. Zwróć uwagę na wpływ wartości właściwości ustawionych na czasownik rozłączenia. Jeśli umieścisz wskaźnik myszy nad przyciskiem Zakończ połączenie , tekst opisu niestandardowego zostanie wyświetlony w etykietce narzędzia. Kliknij przycisk Zakończ połączenie , aby odłączyć kontrolki, które są już połączone z powodu połączenia deklaratywnego na stronie.

Uwagi

Czasownik rozłączania, używany wraz z kontrolką ConnectionsZone , jest czasownikiem na poziomie strefy wyświetlanym w interfejsie użytkownika połączenia w ramach widoku, w którym użytkownicy zarządzają istniejącym połączeniem między dwoma kontrolkami. Po kliknięciu czasownika WebPart connect w menu czasowników kontrolki i pojawieniu się interfejsu użytkownika połączenia, jeśli istnieje już połączenie między dwoma kontrolkami, czasownik rozłączenia zostanie aktywowany w dolnej części interfejsu użytkownika.

DisconnectVerb Użyj właściwości , aby uzyskać odwołanie do odpowiedniego WebPartVerb obiektu w interfejsie użytkownika. Mimo że sama właściwość jest tylko do odczytu, po odwołaniu do czasownika można zmienić jego wartości właściwości zgodnie z potrzebami.

Wartości właściwości czasownika disconnect można ustawić deklaratywnie, deklarując <disconnectverb> element między tagami otwierania i zamykania <asp:connectionszone> elementu. Właściwości czasownika można również ustawić deklaratywnie w tagu otwierającym <asp:connectionszone> elementu, dodając atrybut w formularzu Property-Subproperty, gdzie Subproperty jest właściwością WebPartVerb obiektu (na przykład DisconnectVerb-Text). Właściwości można również ustawić programowo w formularzu Property.Subproperty (na przykład DisconnectVerb.Text).

Dotyczy

Zobacz też