ASP.NET provides two different methods for building composite controls: composition
through custom server controls and composition through user controls. We discuss what
factors can go into choosing one method over the other and provide several introductory
examples later on in this chapter.
Comparing the Control-Building Techniques
As described earlier in this chapter, there are primarily two methods of packing content in
ASP.NET: user controls and custom server controls. We provide a high-level overview of these
methods in the following sections. To assist with this discussion, we??™ll create user controls and
custom server controls that implement the same functionality to help us compare and contrast
the two construction methodologies.
User Controls
User controls are a form of composite control that you can use to package functionality such as
HTML and server controls like the TextBox within ASP.NET. Generally, the focus of user control
development is to encapsulate application-specific business logic that can be shared within a
single application or within a family of related applications.
Of the two primary means of building controls in ASP.NET, user controls are the simpler
control type to create. Constructing user controls is similar to building ASP.
Pages:
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101