WebPartZoneBase.ExportVerb Property

Note: This property is new in the .NET Framework version 2.0.

Gets a reference to a WebPartVerb object that enables end users to export an XML definition file for each WebPart control in a zone.

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

public virtual WebPartVerb ExportVerb { get; }
/** @property */
public WebPartVerb get_ExportVerb ()

public function get ExportVerb () : WebPartVerb

Property Value

A WebPartVerb that enables end users to export a definition file for WebPart controls.

The export verb referenced by the ExportVerb property appears in the verbs drop-down menu within the title bar of each WebPart control in a zone. The verb appears in the verbs menu in all page display modes.

To enable users to export a definition file for a WebPart control, you must also set the ExportMode property on a control to something other than its default value, which is None.

The following code example demonstrates the use of the ExportVerb 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 export 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;
  }
}

The other part of the code example is the Web page that hosts the custom control and contains the user interface (UI). Notice that the declarative <ExportVerb> element in the zone sets the specific text that represents the export verb in the verbs drop-down menu for the WebPart control.

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

Finally, notice that in the following code example, the declarative ExportMode property value on the <asp:TextDisplayWebPart> element is set to the value All, meaning that all exportable property values on the control will be exported.

<asp:CatalogZone ID="CatalogZone1" Runat="server">
  <ZoneTemplate>
    <asp:DeclarativeCatalogPart ID="DeclarativeCatalogPart1" 
      Runat="server">
      <WebPartsTemplate>
        <aspSample:TextDisplayWebPart 
          runat="server"   
          id="textwebpart" 
          title = "Text Content WebPart" 
          width="350px" 
          AllowClose="true"
          ExportMode="All"
          HelpMode="Modal"
          HelpUrl="TextWebPartHelp.htm" />            
      </WebPartsTemplate>
    </asp:DeclarativeCatalogPart> 
    <asp:PageCatalogPart ID="PageCatalogPart1" Runat="server" />
  </ZoneTemplate>
</asp:CatalogZone>

After you load the page in a browser, switch the page into catalog display mode, and add the TextDisplayWebPart control to the page. You can use the check boxes to enable and disable the export verb on the TextDisplayWebPart control. If you click the export verb, you are prompted for a local path to save a definition file for the control.

Windows 98, Windows 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 .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0

Community Additions

ADD
Show: