How to: Provide Optional Web Parts Controls
One feature of the Web Parts control set is the ability to make a catalog of optional controls available for an end user to add to a page.
You must provide a way for end users to view the page in catalog mode so that they can see the catalog. You can do this by setting the DisplayMode property of the local WebPartManager instance to catalog mode, as described in How to: Set the Display Mode of a Web Parts Page. Alternatively, you can create a user control that exposes all available page display modes and provides other useful functionality. For more information, see Walkthrough: Changing Display Modes on a Web Parts Page.
To create a catalog of optional Web Parts controls
Create an ASP.NET Web Parts page with personalization enabled. For details, see Walkthrough: Creating a Web Parts Page.
Inside the DeclarativeCatalogPart control, add a pair of <WebPartsTemplate> tags that contain the controls to include in your catalog. The markup for the CatalogZone zone should now look something like the following example.
<asp:CatalogZone ID="CZ1" runat="server"> <ZoneTemplate> <asp:DeclarativeCatalogPart ID="DCP1" runat="server"> <WebPartsTemplate> <asp:Label ID="Label1" runat="server" Text="Label" /> <asp:Button ID="Button1" runat="server" Text="Button" /> </WebPartsTemplate> </asp:DeclarativeCatalogPart> </ZoneTemplate> </asp:CatalogZone>
The controls inside the DeclarativeCatalogPart control will be available to the end user when the page is viewed in catalog mode.