Web parts for portals—Web parts classes
| CSharp-Online.NET:Articles |
| ASP.NET Articles |
|
How to use web parts to build portals
|
| © 2008 M. Murach & Assoc. |
Classes for working with web parts
Figure 24-9 shows some of the classes that are commonly used to work with web parts. Of these classes, the WebPartManager class is the one that’s most commonly used to work with portals. As you learned earlier in this chapter, you can use this class to switch between display modes. In addition, you can use this class to access a collection of WebPart and WebPartZone objects that correspond to the web parts and zones available from the page. And you can use this class to respond to the events that occur on a web portal such as switching display modes or adding or removing a web part or zone.
In general, the classes described in this figure correspond with the controls that are available from the WebParts group in Visual Studio’s Toolbox. Most of the time, you can use Visual Studio to set the properties for these controls at design time. Whenever necessary, though, you can write code that uses these classes to work with these controls at runtime. To do that, you often need to get a more complete description of the class for the control by looking it up in the documentation for the .NET Framework class library.
Classes for working with web parts
| Class | Description |
| WebPartManager | Can be used to work with all of the zones and web parts on the page, to change display modes for the page, and to respond to events that are raised by the zones and web parts on the page. |
| WebPartZone | Can be used to modify the properties of a web part zone. Many of these properties control the appearance of the web parts within this zone. |
| CatalogZone | Can be used to modify the properties of a catalog zone. Many of these properties control the appearance of the catalog parts within this zone. |
| EditorZone | Can be used to modify the properties of an editor zone. Many of these properties control the appearance of the editor parts within this zone. |
| ConnectionsZone | Can be used to work with connections between custom WebPart controls. |
| WebPartVerb | Can be used to work with a verb, which is a button, link, or menu item in the title bar of a web part. |
| WebPart | Can be used to work with web parts at runtime, or it can be overridden to create a custom WebPart that takes advantage of the advanced features of the portal framework (see figure 24-10). |
| GenericWebPart | Can be used to work with user controls and custom server controls within a web part zone. Many of its properties are inherited from the Panel and Part classes. The ASP.NET portal framework automatically uses this class whenever it needs to wrap ASP.NET controls such as standard controls, user controls, and custom server controls so they behave like web parts. |
| PageCatalogPart | Can be used to work with the web parts in the page catalog, including parts that a user has closed. |
| DeclarativeCatalogPart | Can be used to work with the web parts in the declarative catalog. |
| ImportCatalogPart | Can be used to import a catalog of web parts. |
| BehaviorEditorPart | Can be used to apply behavior changes to an associated web part. |
| AppearanceEditorPart | Can be used to apply appearance changes to an associated web part. |
| LayoutEditorPart | Can be used to apply layout changes to a web part. |
| PropertyGridEditorPart | Can be used to change the property grid of a web part. |
Description
- For a complete description of each class, including its constructors, properties, methods, and events, look up the class in the documentation for the .NET Framework class library.
|

