Partilhar via


ImportCatalogPart Web Server Control Overview

The ImportCatalogPart Web server control imports a description file for a WebPart control.

This topic contains:

  • Background

  • Code Examples

  • Class Reference

Background

The ImportCatalogPart Web server control imports a description file for a WebPart control (or other ASP.NET server control that is used as a WebPart control). This enables the control to be added to a Web page with pre-assigned settings. The description file enables users to share settings for WebPart controls.

The description file is not the same as the control itself. It is an XML file that ends with a .WebPart file name extension and that contains name/value pairs that describe the state of the control. For information about the XML schema for the description file, see Web Parts Control Description Files. In addition to describing the control' state, the description file references the control name and the assembly (or file) that contains the control.

After a user imports a description file, the WebPart control referenced in the file appears in the ImportCatalogPart control, and a user can add the control to the page.

Associating Web Parts Controls with an ImportCatalogPart Web Server Control

A Web Parts control that is associated with a ImportCatalogPart control can be compiled into an assembly, or it can be a user control (.ascx file). In either case, the control referenced in an imported description file must exist on the Web server that contains the hosting page.

Users import a description file and its associated server control into a Web page by using the ImportCatalogPart control. This control must already be on the page. When a user switches the page to catalog display mode, the ImportCatalogPart control is displayed. Users can then browse to the control's .WebPart description file and import the control. The control's appearance and properties are specified in the imported description file.

Before they import a WebPart control description file, users must first create (export) the file based on an existing WebPart control. A description file can be exported for a control if the following conditions are met:

  • The control has properties marked with the Personalizable attribute.

  • The Web.config file has the enableExport attribute value set to true in the webParts element.

  • You have set the value of the control's ExportMode property to a value other than the default value of None, which prohibits export.

Enabling an ImportCatalogPart Web Server Control

The ImportCatalogPart Web server control is displayed at run time when a Web Parts page is in edit mode, and when the user has selected an associated WebPart control for editing. For more information, see Walkthrough: Changing Display Modes on a Web Parts Page.

For a code example that shows how to use the ImportCatalogPart Web server control, see the "Example" section of ImportCatalogPart.

Back to top

Code Examples

Walkthrough: Creating a Web Parts Page

How to: Treat a User Control as a Web Parts Control

How to: Provide Optional Web Parts Controls

How to: Enable Users to Import Web Parts Control Settings

How to: Export Web Parts Control Settings

How to: Build and Run the Data-bound Web Parts Control Example

Walkthrough: Changing Display Modes on a Web Parts Page

How to: Set the Display Mode of a Web Parts Page

Walkthrough: Implementing Web Parts Personalization with a User Control

Walkthrough: Implementing Web Parts Personalization using IPersonalizable

How to: Enable Shared Personalization of Web Parts Pages

How to: Disable Web Parts Personalization

How to: Create Personalizable Properties on a Web Parts Control

How to: Remove User Entries from the Personalization Store

How to: Enable Users to Clear Personalization State

How to: Declare a Static Connection between Two Web Parts Controls

Back to top

Class Reference

Back to top

See Also

Concepts

ImportCatalogPart Web Server Control Overview

DeclarativeCatalogPart Web Server Control Overview

PageCatalogPart Web Server Control Overview

Reference

ImportCatalogPart Web Server Control Declarative Syntax

DeclarativeCatalogPart

CatalogZone

System.Web.UI.WebControls.WebParts

Web Parts Control Description Files

Other Resources

ASP.NET Web Parts Controls