Adding Catalog Zones
A CatalogZone control allows users to select from a list of available Web Parts and add them to WebPartZone controls. In this lesson you will learn how to add CatalogZone and PageCatalogPart controls and use them in your Web application.
1. From the ToolBox drag a CatalogZone control onto the WebParts.aspx design surface, placing it below the RadioButtonList control.

2. Drag a PageCatalogPart into the CatalogZone control.

Generic //一般的WebPart control names (e.g., "WebPart1") appear in the PageCatalogPart control. The actual Web Parts in your application—that is, the two that you added in previous lessons—will appear when the page loads.
3. To switch to the Catalog display mode you must add another option to the RadioButtonList control. Open the RadioButtonList Tasks menu and click Edit Items. Add a new item called "Catalog", and then click OK.
4. Double-click the RadioButtonList control, and to the existing flow control statement in the SelectedIndexChanged event handler, add the following, which supports switching to//转换到 the Catalog display mode:
| C# | VB | |
case 3:
authorsWebPartManager.DisplayMode = WebPartManager.CatalogDisplayMode;
break;
|
||
5. In the Solution Explorer select login.aspx and then press F5 to run the application. Log in//登入 as one of the application's users. Navigate to//导航到 WebParts.aspx, and then select Catalog.
Notice that no Web Parts appear the PageCatalogPart control. This is because all available Web Parts are already on the page.
6. In the My Calendar Web Part menu, select Close.

Notice that the Web Part now appears in the PageCatalogPart control.
7. Check My Calendar. For Add to select midColWebPartZone, and then click Add.

The My Calendar Web Part now appears in the middle column with the other Web Part.
浙公网安备 33010602011771号