[ Team LiB ] |
Chapter 6. User Controls and Custom Server ControlsReuse, a technique that is important to most developers, allows you to avoid constantly reinventing the wheel by using functionality that has already been built and tested. Reuse increases productivity, by reducing the total amount of code you need to write, and reliability, since by using tested code, you (presumably) already know the code works reliably. ASP.NET provides a range of options for reuse. The first is the wide variety of built-in server controls that ship with ASP.NET. These server controls alone can eliminate hundreds, or even thousands, of lines of code that needed to be written to achieve the same effect in classic ASP. In addition, the .NET Framework Class Library (FCL) provides hundreds of classes to perform actions (such as sending SMTP email or making network calls) that in classic ASP would have required purchasing a third-party component or making calls into the Win32 API. Of course, the framework classes provide built-in functionality more than reuse. Fortunately, the framework also provides robust support for developing your own classes, user controls, and custom server controls, allowing you to reuse your own code as well. Going hand-in-hand with reuse is the concept of extensibility, the ability to take the existing functionality provided by the .NET Framework and ASP.NET and extend it to perform actions that are more tailored to your particular applications and problem domains. ASP.NET provides a significant number of avenues for extensibility:
The rest of this chapter discusses employing ASP.NET user controls and custom server controls for reuse and employing custom server controls for extensibility. The chapter also explains how custom server controls can easily be shared across multiple applications, making reuse simpler than ever. |
[ Team LiB ] |