Επεξεργασία

Κοινή χρήση μέσω


IWebActionable.Verbs Property

Definition

Gets a reference to a collection of custom WebPartVerb objects.

public:
 property System::Web::UI::WebControls::WebParts::WebPartVerbCollection ^ Verbs { System::Web::UI::WebControls::WebParts::WebPartVerbCollection ^ get(); };
public System.Web.UI.WebControls.WebParts.WebPartVerbCollection Verbs { get; }
member this.Verbs : System.Web.UI.WebControls.WebParts.WebPartVerbCollection
Public ReadOnly Property Verbs As WebPartVerbCollection

Property Value

A WebPartVerbCollection that contains custom WebPartVerb objects.

Examples

The following code example demonstrates the use of the Verbs property as implemented in a user control. The full code for this code example can be found in the Example section of the IWebActionable class overview topic.

The following portion of the code example demonstrates a custom implementation of the Verbs property within a user control.

// This property implements the IWebActionable interface.
WebPartVerbCollection IWebActionable.Verbs
{
  get
  {
    if (m_Verbs == null)
    {
      ArrayList verbsList = new ArrayList();
      WebPartVerb onlyVerb = new WebPartVerb
        ("customVerb1", new WebPartEventHandler(IncrementVerbCounterClicks));
      onlyVerb.Text = "My Verb";
      onlyVerb.Description = "VerbTooltip";
      onlyVerb.Visible = true;
      onlyVerb.Enabled = true;
      verbsList.Add(onlyVerb);
      WebPartVerb otherVerb = new WebPartVerb
        ("customVerb2", new WebPartEventHandler(IncrementVerbCounterClicks));
      otherVerb.Text = "My other Verb";
      otherVerb.Description = "Other VerbTooltip";
      otherVerb.Visible = true;
      otherVerb.Enabled = true;
      verbsList.Add(otherVerb);
      m_Verbs = new WebPartVerbCollection(verbsList);
      return m_Verbs;
    }
    return m_Verbs;
  }
}
' This property implements the IWebActionable interface.
ReadOnly Property Verbs() As WebPartVerbCollection _
  Implements IWebActionable.Verbs
  Get
    If (m_Verbs Is Nothing) Then
      Dim verbsList As New ArrayList()
      Dim onlyVerb As New WebPartVerb _
        ("customVerb1", New WebPartEventHandler(AddressOf IncrementVerbCounterClicks))
      onlyVerb.Text = "My Verb"
      onlyVerb.Description = "VerbTooltip"
      onlyVerb.Visible = True
      onlyVerb.Enabled = True
      verbsList.Add(onlyVerb)
      Dim otherVerb As New WebPartVerb _
        ("customVerb2", New WebPartEventHandler(AddressOf IncrementVerbCounterClicks))
      otherVerb.Text = "My other Verb"
      otherVerb.Description = "Other VerbTooltip"
      otherVerb.Visible = True
      otherVerb.Enabled = True
      verbsList.Add(otherVerb)
      m_Verbs = New WebPartVerbCollection(verbsList)
    End If
    Return m_Verbs
  End Get
End Property

Remarks

The Verbs property references a collection of custom verbs (if any) that are added to a verbs menu in the header of a WebPart or other server control. The Verbs collection does not contain references to the standard WebPartVerb objects provided with the Web Parts control set, such as CloseVerb, DeleteVerb, EditVerb, RestoreVerb, or MinimizeVerb.

Developers who want to add custom verbs to a custom control that derives from the WebPart class can simply override the Verbs property that the WebPart class implements.

Developers who want to add custom verbs to a user control, or a custom control that is not a WebPart control, must implement the IWebActionable interface by providing an implementation of the Verbs property.

Applies to

See also