Edit

Share via


WebPartZoneBase.MinimizeVerb Property

Definition

Gets a reference to a WebPartVerb object that enables end users to minimize WebPart controls in a zone.

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

Property Value

A WebPartVerb that enables end users to minimize WebPart controls.

Attributes

Examples

The following code example demonstrates the use of the MinimizeVerb property on a WebPartZone control. For the code example to work, you need all the code from the Example section of the HelpVerb property.

The following part of the code example is from the partial class, and contains the code that toggles whether the minimize 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

The other part of the code example is the Web page that hosts the custom WebPart control and contains the user interface (UI). Notice that the declarative <MinimizeVerb> element in the zone sets the value for the Description attribute text, which appears as a ToolTip when a user positions the mouse pointer over the verb in the verbs menu.

<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>

After you load the page in a browser, switch the page into catalog display mode, and add the TextDisplayWebPart control to the page, if it has not been added. You can use the check boxes to enable and disable the minimize verb on the TextDisplayWebPart control. When the verb is enabled, you can also click it to minimize the control.

Remarks

The minimize verb referenced by the MinimizeVerb property appears in the verbs menu of each WebPart control in a zone. The verb appears in all page display modes.

Minimizing a control collapses it down to a smaller size, leaves only the title bar of the control visible, and makes a restore verb visible in the title bar.

Applies to

See also