Chapter 6. User Controls and Custom Server Controls
Reuse
is a technique that is important to most developers. Reuse allows you
to avoid constantly reinventing the wheel by using functionality that
has already been built and tested. It 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.
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:
- Custom server controls
Allow you to create entirely new controls for use with ASP.NET or to derive from existing controls and extend or modify their functionality.
- Components
As in classic ASP, components ...
Get ASP.NET in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.