O'Reilly logo

ASP.NET 2.0: A Developer's Notebook by Wei-Meng Lee

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Let Users Add Web Parts at Runtime

Note

Provide a list of Web Parts to let users choose themselves.

In addition to the Web Parts already visible when the user loads the page, you can provide users with a list of other available Web Parts they can selectively add to the page. For example, in My MSN, you can choose from a list of available content that you can add to your page (see Figure 3-23).

Adding additional content in http://my.msn.com

Figure 3-23. Adding additional content in http://my.msn.com

To let users add Web Parts to the page, you will use the DeclarativeCatalogPart, PageCatalogPart, and ImportCatalogPart controls.

How do I do that?

In this lab, you will learn how to use the CatalogZone control to list Web Parts available for users to add when they're running your application. You will use the CatalogZone control and the three related CatalogPart controls—DeclarativeCatalogZone, PageCatalogZone, and ImportCatalogZone—so that users can look for and add Web Parts from a variety of sources.

Here is a quick overview of the controls you will use in this lab:

CatalogZone

Contains CatalogPart controls (DeclarativeCatalogPart, PageCatalogPart, and ImportCatalogPart). This control is used to create a catalog of Web Part controls so that users can select controls to add to a page.

DeclarativeCatalogPart

Enables developers to add a catalog of Web Part controls to a web page so that users can choose to add them to a page.

PageCatalogPart ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required