Chapter 42. The System.Web.UI.WebControls Namespace
The System.Web.UI.WebControls namespace contains types used for web controls. Web controls are ASP.NET's most full-featured controls and range from straightforward elements like Button to sophisticated controls like Calendar, AdRotator, and DataGrid. Web controls are more abstract than HTML controls. Rather than wrapping specific HTML elements, web controls can consist of a combination of HTML elements and vary their user interface depending on the capabilities of the client browser. They also provide a richer set of formatting properties and events. For example, all input controls provide an AutoPostback property that, when set to True, allows your code to react immediately to a Change event (like a checkbox being checked or a new list selection).
This namespace contains the WebControl class, which is the base class for all web controls. Web controls include traditional standards like TextBox, Button, RadioButton, and CheckBox, and more unusual and advanced controls like Calendar, AdRotator, and the list controls CheckBoxList and RadioButtonList.
Some of the most interesting controls in this namespace include those used for data-bound tables. Typically, DataGrid provides the most powerful options, with features for paging, sorting, and automatic selection and editing. You can also use the DataList class for a templated list or the Repeater class for a simple data-bound repeater that allows completely customized layout but has no built-in formatting or support for higher-level features like selection and editing.
Other useful controls in this namespace include the validation controls that derive from BaseValidator. These controls include CompareValidator (which compares data to an expected value), RangeValidator (which ensures that data falls in a specified range), RegularExpressionValidator (which validates data using a regular expression), RequiredFieldValidator (which ensures that data has been entered), and CustomValidator (which allows you to create your own validation routines). Optionally, validation results can be displayed using the ValidationSummary control.