EditorZoneBase.CancelVerb Property

Gets a reference to a WebPartVerb object that enables end users to cancel editing changes to a control in edit mode.

Namespace: System.Web.UI.WebControls.WebParts
Assembly: System.Web (in system.web.dll)

public virtual WebPartVerb CancelVerb { get; }
/** @property */
public WebPartVerb get_CancelVerb ()

public function get CancelVerb () : WebPartVerb

Not applicable.

Property Value

A WebPartVerb that enables end users to cancel editing changes to a control.

The cancel verb is referenced by the CancelVerb property on a control derived from the EditorZoneBase class. The cancel verb cancels editing changes that an end user has made to a server control in the editing user interface (UI). By default, the cancel verb appears in the UI as a Button control. The type of button can be an image, a link, or an actual button; you can set this for all verb buttons in a zone (not for individual buttons) by setting the inherited VerbButtonType property at the zone level.

When a user cancels editing changes, none of the changes in the EditorPart controls are applied to the server control that is being edited. In addition, the page remains in edit display mode, but the EditorPart controls are hidden and the WebPart control that was being edited is no longer selected. This allows an end user to select another WebPart control to edit without having to change display modes again.

The cancel verb is a zone-level control, meaning that while there might be several EditorPart controls, each editing one or more properties for the server control that is in edit mode, the cancel verb works universally to cancel all changes from all the EditorPart controls in the zone.

The following code example demonstrates how to access the CancelVerb property both declaratively and programmatically. For the full code required to run the example, see the Example section of the EditorZoneBase class overview topic.

The first part of the code example shows how to access the CancelVerb property declaratively in a Web page. This example customizes the text for the verb.

<aspSample:MyEditorZone ID="EditorZone1" runat="server">
  <ApplyVerb Text="Apply Changes" />
  <CancelVerb Text="Cancel Changes" />
  <OKVerb Text="Finished" />
    <asp:AppearanceEditorPart ID="AppearanceEditorPart1" 
      runat="server" />
    <asp:LayoutEditorPart ID="LayoutEditorPart1" 
      runat="server" />

The second part of the example shows how to access the CancelVerb property programmatically, by using a toggle button to enable or disable it.

void Button2_Click(object sender, EventArgs e)
  if (EditorZone1.CancelVerb.Enabled)
    EditorZone1.CancelVerb.Enabled = false;
    EditorZone1.CancelVerb.Enabled = true;

When you load the page in a browser, you can select Edit Mode in the drop-down list control to switch to edit mode. You can click the verbs menu (the down arrow) in the title bar of one of the controls, and click Edit to edit the selected control. When the EditorZone control and editing UI are visible, you can see the button that represents the cancel verb, and click the Toggle CancelVerb Enabled button to enable or disable it.

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0

Community Additions