संपादित करें

इसके माध्यम से साझा किया गया


EditorZoneBase.OKVerb Property

Definition

Gets a reference to a WebPartVerb object that applies editing changes to a control in edit mode, and hides the editing user interface (UI).

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

Property Value

A WebPartVerb that applies editing changes to a control and hides the editing UI.

Attributes

Examples

The following code example demonstrates how to access the OKVerb 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 OKVerb 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" />
  <ZoneTemplate>
    <asp:AppearanceEditorPart ID="AppearanceEditorPart1" 
      runat="server" />
    <asp:LayoutEditorPart ID="LayoutEditorPart1" 
      runat="server" />
  </ZoneTemplate>
</aspSample:MyEditorZone>
<aspSample:MyEditorZone ID="EditorZone1" runat="server">
  <ApplyVerb Text="Apply Changes" />
  <CancelVerb Text="Cancel Changes" />
  <OKVerb Text="Finished" />
  <ZoneTemplate>
    <asp:AppearanceEditorPart ID="AppearanceEditorPart1" 
      runat="server" />
    <asp:LayoutEditorPart ID="LayoutEditorPart1" 
      runat="server" />
  </ZoneTemplate>
</aspSample:MyEditorZone>

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

void Button4_Click(object sender, EventArgs e)
{
  if (EditorZone1.OKVerb.Enabled)
    EditorZone1.OKVerb.Enabled = false;
  else
    EditorZone1.OKVerb.Enabled = true;
}
Sub Button4_Click(ByVal sender As Object, ByVal e As EventArgs)
  If EditorZone1.OKVerb.Enabled Then
    EditorZone1.OKVerb.Enabled = False
  Else
    EditorZone1.OKVerb.Enabled = True
  End If

End Sub

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 OK verb, and click the Toggle OKVerb Enabled button to enable or disable it.

Remarks

The OK verb is referenced by the OKVerb property on a control derived from the EditorZoneBase class. It is similar to the apply verb, in that when a user clicks it, it applies editing changes that the user has made to a server control. In addition, the editing controls are hidden, the WebPart control that was being edited is no longer selected (which allows the user to edit another control), and the page remains in edit mode.

By default, the OK 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.

The OK 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 OK verb works universally to apply all changes from all the EditorPart controls in the zone, and to hide all the controls except for the zone itself.

Applies to

See also