แก้ไข

แชร์ผ่าน


CatalogZoneBase.CloseVerb Property

Definition

Gets a reference to a WebPartVerb object that enables end users to close the catalog user interface (UI) and return the page to normal browse mode.

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

Property Value

A WebPartVerb that enables end users to close the catalog UI on the Web page.

Attributes

Examples

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

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

<asp:CatalogZone ID="CatalogZone1" runat="server"
  EmptyZoneText="No controls are in the zone."
  HeaderText="My Web Parts Catalog"
  InstructionText="Add Web Parts controls to the zone."
  PartLinkStyle-Font-Italic="true"
  SelectedPartLinkStyle-Font-Bold="true"
  SelectTargetZoneText="Select zone"
  AddVerb-Text="Add Control"
  CloseVerb-Description="Close and return to browse mode." 
  SelectedCatalogPartID="Currently Selected CatalogPart ID.">
  <ZoneTemplate>
    <asp:DeclarativeCatalogPart ID="DeclarativeCatalogPart1" 
      runat="server">
      <WebPartsTemplate>
        <aspSample:TextDisplayWebPart 
          runat="server"   
          id="textwebpart" 
          title = "Text Content WebPart" 
          ExportMode="All"/>  
        <asp:Calendar id="calendar1" runat="server" 
          Title="My Calendar" />               
      </WebPartsTemplate>
    </asp:DeclarativeCatalogPart> 
    <asp:PageCatalogPart ID="PageCatalogPart1" runat="server" />
    <asp:ImportCatalogPart ID="ImportCatalogPart1" runat="server" /> 
  </ZoneTemplate>
</asp:CatalogZone>
<hr />
<asp:CatalogZone ID="CatalogZone2" runat="server"
  BorderWidth="2"
  HeaderText="My Empty CatalogZone"
  EmptyZoneText="No controls are in the zone." />
<asp:CatalogZone ID="CatalogZone1" runat="server"
  EmptyZoneText="No controls are in the zone."
  HeaderText="My Web Parts Catalog"
  InstructionText="Add Web Parts controls to the zone."
  PartLinkStyle-Font-Italic="true"
  SelectedPartLinkStyle-Font-Bold="true"
  SelectTargetZoneText="Select zone"
  AddVerb-Text="Add Control"
  CloseVerb-Description="Close and return to browse mode." 
  SelectedCatalogPartID="Currently Selected CatalogPart ID.">
  <ZoneTemplate>
    <asp:DeclarativeCatalogPart ID="DeclarativeCatalogPart1" 
      runat="server">
      <WebPartsTemplate>
        <aspSample:TextDisplayWebPart 
          runat="server"   
          id="textwebpart" 
          title = "Text Content WebPart" 
          ExportMode="All"/>  
        <asp:Calendar id="calendar1" runat="server" 
          Title="My Calendar" />               
      </WebPartsTemplate>
    </asp:DeclarativeCatalogPart> 
    <asp:PageCatalogPart ID="PageCatalogPart1" runat="server" />
    <asp:ImportCatalogPart ID="ImportCatalogPart1" runat="server" /> 
  </ZoneTemplate>
</asp:CatalogZone>
<hr />
<asp:CatalogZone ID="CatalogZone2" runat="server"
  BorderWidth="2"
  HeaderText="My Empty CatalogZone"
  EmptyZoneText="No controls are in the zone." />

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

protected void Button1_Click(object sender, EventArgs e)
{
  if (CatalogZone1.AddVerb.Enabled)
  {
    CatalogZone1.AddVerb.Enabled = false;
    CatalogZone1.CloseVerb.Enabled = false;
  }
  else
  {
    CatalogZone1.AddVerb.Enabled = true;
    CatalogZone1.CloseVerb.Enabled = true;
  }
}
Protected Sub Button1_Click(ByVal sender As Object, _
  ByVal e As EventArgs)
  If CatalogZone1.AddVerb.Enabled Then
    CatalogZone1.AddVerb.Enabled = False
    CatalogZone1.CloseVerb.Enabled = False
  Else
    CatalogZone1.AddVerb.Enabled = True
    CatalogZone1.CloseVerb.Enabled = True
  End If

End Sub

When you load the page in a browser, you can select Catalog from the drop-down list to switch to catalog display mode. When the catalog is visible, by positioning your mouse pointer over the Close button, you can see its description text in a ToolTip. You can also click the Enable or Disable Verbs button to demonstrate that you can access the close verb programmatically.

Remarks

The close verb is referenced by the CloseVerb property on a control derived from the CatalogZoneBase class.

User can click the close verb in the zone footer. When the user clicks the close verb, any CatalogPart controls the user has selected are ignored, the catalog UI closes, and the page returns to normal browse mode.

The close verb is a zone-level control, meaning that its action applies at the level of the whole zone. When a user clicks the close verb, any controls that have been selected but not added to the page are ignored, the catalog is closed, and the page returns to browse mode.

Applies to

See also