Programming Microsoft Web Forms (Pro Developer)
Overview
When developers first began to create Web Forms applications, the process was very different than it is in the Microsoft ASP.NET 2.0 development environment. A major element missing from the mix, for example, was the ability to drag and drop controls onto a Web Form. Controls provide encapsulated functionality, and developers can quickly create applications in ASP.NET 2.0 by combining controls. Controls may have fallen short of the ideal of using components to wire together complete applications, but they do offer the ability to reduce the amount of code for common tasks.
Controls can be visual or non-visual. Most controls expose some user interface. For example, labels and text boxes are visual controls. When you place one of these controls on a form, you expect that the resulting form will have, respectively, a label or text box. On the other hand, a control such as a SqlDataSource control is non-visual and can be placed on a control in Microsoft Visual Studio Design view. Although a non-visual control might be used by a visual control such as GridView or DropDownList, non-visual controls do not appear on the form, because they are strictly server-side controls.
Controls fall into two broad categories. The first, and easiest to create, is a user control. A user control is a control that you create just like you would create a Web Form. A user control allows you to drag and drop other controls (and even other user controls) onto the user control design surface, and then create event handlers on the events exposed by the user controls, as well as the controls on the user control. The other category of controls is known generically as server controls. Although it is possible to create new server controls, developers commonly use server controls created by other developers. Chapter 6, "Custom Controls," will cover creation of both user controls and custom server controls.