WebPartZoneBase.DeleteVerb Propiedad

Definición

Obtiene una referencia a un objeto WebPartVerb que permite a los usuarios finales eliminar los controles WebPart de una zona.Gets a reference to a WebPartVerb object that enables end users to delete the WebPart controls in a zone.

public:
 virtual property System::Web::UI::WebControls::WebParts::WebPartVerb ^ DeleteVerb { System::Web::UI::WebControls::WebParts::WebPartVerb ^ get(); };
[System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)]
public virtual System.Web.UI.WebControls.WebParts.WebPartVerb DeleteVerb { get; }
[<System.Web.UI.PersistenceMode(System.Web.UI.PersistenceMode.InnerProperty)>]
member this.DeleteVerb : System.Web.UI.WebControls.WebParts.WebPartVerb
Public Overridable ReadOnly Property DeleteVerb As WebPartVerb

Valor de propiedad

WebPartVerb

WebPartVerb que permite a los usuarios finales eliminar controles WebPart.A WebPartVerb that enables end users to delete WebPart controls.

Atributos

Ejemplos

En el ejemplo de código siguiente se muestra el uso de la DeleteVerb propiedad en un WebPartZone control.The following code example demonstrates the use of the DeleteVerb property on a WebPartZone control. Para que el ejemplo de código funcione, necesita todo el código de la sección de ejemplo de la HelpVerb propiedad.For the code example to work, you need all the code from the Example section of the HelpVerb property.

La siguiente parte del ejemplo de código es de la clase parcial y contiene el código que alterna si el verbo Delete está habilitado o deshabilitado.The following part of the code example is from the partial class, and contains the code that toggles whether the delete verb is enabled or disabled.

protected void CheckBoxList1_SelectedItemIndexChanged(Object sender, EventArgs e)
{
  foreach (ListItem item in CheckBoxList1.Items)
  {
    WebPartVerb theVerb;
    switch (item.Value)
    {
      case "close":
        theVerb = WebPartZone1.CloseVerb;
        break;
      case "export":
        theVerb = WebPartZone1.ExportVerb;
        break;
      case "delete":
        theVerb = WebPartZone1.DeleteVerb;
        break;
      case "minimize":
        theVerb = WebPartZone1.MinimizeVerb;
        break;
      case "restore":
        theVerb = WebPartZone1.RestoreVerb;
        break;
      default:
        theVerb = null;
        break;
    }

    if (item.Selected)
      theVerb.Enabled = true;
    else
      theVerb.Enabled = false;
  }
}
Protected Sub CheckBoxList1_SelectedItemIndexChanged(ByVal sender As [Object], ByVal e As EventArgs)
  Dim item As ListItem
  For Each item In CheckBoxList1.Items
    Dim theVerb As WebPartVerb
    Select Case item.Value
      Case "close"
        theVerb = WebPartZone1.CloseVerb
      Case "export"
        theVerb = WebPartZone1.ExportVerb
      Case "delete"
        theVerb = WebPartZone1.DeleteVerb
      Case "minimize"
        theVerb = WebPartZone1.MinimizeVerb
      Case "restore"
        theVerb = WebPartZone1.RestoreVerb
      Case Else
        theVerb = Nothing
    End Select

    If item.Selected Then
      theVerb.Enabled = True
    Else
      theVerb.Enabled = False
    End If
  Next item

End Sub

La otra parte del ejemplo de código es la página web que hospeda el control personalizado y contiene la interfaz de usuario (UI).The other part of the code example is the Web page that hosts the custom control and contains the user interface (UI). Observe que el elemento declarativo <DeleteVerb> de la zona establece el texto específico que representa el verbo eliminar en el menú desplegable de verbos para el WebPart control.Notice that the declarative <DeleteVerb> element in the zone sets the specific text that represents the delete verb in the verbs drop-down menu for the WebPart control.

<asp:WebPartZone ID="WebPartZone1" Runat="server">
  <CloseVerb Text="Close WebPart" />
  <HelpVerb Text="View Help" />
  <ExportVerb Text="Export WebPart Definition" />
  <DeleteVerb Text ="Delete WebPart" />
  <MinimizeVerb Description="Minimize the control" />
  <RestoreVerb Description="Restore the control" />
  <ZoneTemplate>
  </ZoneTemplate>  
</asp:WebPartZone>
<asp:WebPartZone ID="WebPartZone1" Runat="server">
  <CloseVerb Text="Close WebPart" />
  <HelpVerb Text="View Help" />
  <ExportVerb Text="Export WebPart Definition" />
  <DeleteVerb Text ="Delete WebPart" />
  <MinimizeVerb Description="Minimize the control" />
  <RestoreVerb Description="Restore the control" />
  <ZoneTemplate>
  </ZoneTemplate>  
</asp:WebPartZone>

Después de cargar la página en un explorador, cambie la página al modo de presentación del catálogo y agregue el TextDisplayWebPart control a la página.After you load the page in a browser, switch the page into catalog display mode, and add the TextDisplayWebPart control to the page. Puede utilizar las casillas para habilitar y deshabilitar el verbo eliminar en el TextDisplayWebPart control, pero el verbo solo aparece en el menú mientras la página está en el modo de presentación de catálogo o diseño.You can use the check boxes to enable and disable the delete verb on the TextDisplayWebPart control, but the verb appears on the menu only while the page is in catalog or design display mode. Si hace clic en el verbo eliminar WebPart en el menú, el control se eliminará de forma permanente y la instancia eliminada no se podrá volver a agregar a la página.If you click the Delete WebPart verb on the menu, the control is permanently deleted, and the deleted instance cannot be added back to the page. Sin embargo, puede devolver la página al modo de presentación del catálogo y agregar una nueva instancia del TextDisplayWebPart control.However, you can return the page to catalog display mode, and add a new instance of the TextDisplayWebPart control.

Comentarios

El verbo eliminar al que hace referencia la DeleteVerb propiedad aparece en el menú desplegable de verbos en la barra de título de cada WebPart control dinámico de una zona.The delete verb referenced by the DeleteVerb property appears in the verbs drop-down menu in the title bar of each dynamic WebPart control in a zone. El verbo delete no está disponible en los controles estáticos (controles declarados en el marcado de la página web).The delete verb is not available on static controls (controls declared in the markup of the Web page). El verbo solo aparece en el menú de verbos cuando la página está en un modo de presentación que le permite cambiar el diseño de página, como CatalogDisplayMode o DesignDisplayMode .The verb appears in the verbs menu only when the page is in a display mode that enables you to change the page layout, such as CatalogDisplayMode or DesignDisplayMode.

Al eliminar un control, se quita de forma permanente la instancia de ese control de una página.Deleting a control permanently removes the instance of that control from a page. A diferencia de un control cerrado, una instancia eliminada de un control nunca se puede volver a agregar a una página.Unlike a closed control, a deleted instance of a control can never be added back to a page. Cuando un usuario elimina un control y, a continuación, cambia una página a CatalogDisplayMode , si la CatalogZone zona contiene un PageCatalogPart control, la instancia de control eliminada no está disponible en ella.When a user deletes a control, and then switches a page into CatalogDisplayMode, if the CatalogZone zone contains a PageCatalogPart control, the deleted control instance is not available in it. El usuario puede Agregar una nueva instancia de un control, si el control está disponible en el catálogo, pero la instancia eliminada se ha quitado de forma permanente.The user can add a new instance of a control, if the control is available in the catalog, but the deleted instance has been permanently removed.

Se aplica a

Consulte también