11.0 Introduction


Web parts are the new building blocks of personalization in ASP.NET 2.0. Any controlwhether a standard server control, custom control, user control, or web part controlcan be used as a web part without modification.

In its simplest form, a web part consists of an ASP.NET server or user control that takes advantage of the Web Parts control set, which is a group of structural components consisting of the following minimum set:


WebPartManager control

Responsible for managing all other web part controls on the page


WebPartZone control

Defines an area on a page where web parts can be placed


CatalogZone control

Responsible for managing the user interface that displays the available web parts and provides the user the ability to select web parts and add them to WebPartZones

Creating a web part and using the Web Parts control set on an ASP.NET page is a natural first step in learning how to build web parts and is the subject of this chapter's first recipe.

As you create a stable of web parts, you will find you want to reuse them on many pages in your applications, yet having to declare each web part on each page can be a stumbling block. Creating a reusable web parts catalog circumvents this issue and is the subject of the chapter's second recipe.

ASP.NET server controls and user controls can be effective when used as web parts. Nevertheless, you may need additional functionality not provided by these controlsfor example, when you want the ability to build your web parts into a separate assembly for sharing with other applications. When this is the case, creating a custom web part can be a good alternative and is the subject of the chapter's third recipe.

Communicating between web parts is another common scenario that you may need to support in your applications and is the subject of the fourth recipe in the chapter. For example, this recipe shows you how to communicate between one web part that acts as a filter for data to be displayed by another web part.

When you've built your own web parts, complete with custom properties, you'll want to store the custom property settings so the next time users revisit your application, their property settings will be reflected. Persisting the user's web part property settings along with the other web part personalization data is the subject of the last recipe in the chapter.

Though some of these recipes are fairly detailed, this chapter only scratches the surface of web parts, which, along with web portal development, is a career topic. Having said that, once you are familiar with the basics of web parts, you will find that the ASP.NET 2.0 web part infrastructure meets the needs of most of your applications right out of the box. Indeed, you will probably have to add little code to begin implementing a portal-style application.



ASP. NET Cookbook
ASP.Net 2.0 Cookbook (Cookbooks (OReilly))
ISBN: 0596100647
EAN: 2147483647
Year: 2003
Pages: 202

Similar book on Amazon

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net