Datasheet

This description of how a Web Part is used on a SharePoint site omits an important step. After a Web
Part is created it is added to one of several Web Part galleries available to the SharePoint site. Once a
Web Part is available to a site, developers then add the Web Part to a page. Users can add Web Parts to
a SharePoint page only if the Web Part is in one of the galleries for the site. Galleries aren’t part of the
ASP.NET 2.0 implementation of Web Parts.
The Benefits of Reusable Controls
By creating your own controls, you can build a toolkit of controls to draw on when building a Web
application. Think of these controls as reusable visual components. A control can range from something
as simple as displaying a title to being a complete business application in itself.
Much of the talk about the benefits of creating objects and components seems to revolve around abstract
features (encapsulation, polymorphism, and so on). For a developer working in the real world, creating
components really provides three practical benefits in terms of reusability:
Productivity: By creating reusable components, you don’t have to re-invent the wheel when
implementing similar functionality in different applications (or parts of the same application).
Standardization: By using the same components to perform operations that are common to dif-
ferent pages, you are guaranteed that the functionality is implemented in a common way.
Simplification: By dividing functionality between specialized components and other parts of
the application (such as workflow management, business logic, data access), the complexity in
any one part is reduced.
Web Parts, custom controls, and user controls provide all three of these benefits. Web Parts add features
that custom controls and user controls do not. These features include:
Integration: Web Parts on the same page can find one another and exchange information.
Property settings that can be changed by the user: At run time, users can change property set-
tings for a Web Part to further customize the application for themselves or others.
Page design: Web Parts can be added or removed from the page, relocated to other parts of the
page, or just minimized to “de-clutter” the page.
The benefits of reusability with object-oriented development are so well known that they form part of
the conventional wisdom of modern application developers. But Web Parts also provide another benefit:
customization. The benefits of customization are not as commonly known, however, so the next section
describes why customization matters to you.
While Web Parts have become part of the toolkit for all ASP.NET developers,
currently Web Parts developed in ASP.NET 2.0 can’t be used in SharePoint (and
Web Parts built for SharePoint can’t be used outside of SharePoint). However,
Microsoft has committed to providing an upgrade to SharePoint that will allow
ASP.NET 2.0 Web Parts to be used in SharePoint in the near future.
6
Chapter 1
05_57860x ch01.qxd 10/4/05 9:26 PM Page 6