[ Team LiB ] |
Chapter 42. The System.Web.UI.WebControls NamespaceThe 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. Figure 42-1 shows the controls in this namespace. Figure 42-2 and Figure 42-3 show the remaining types, including delegates and events. Figure 42-1. Controls in the System.Web.UI.WebControls namespaceFigure 42-2. Delegates, events, and other typesFigure 42-3. Remaining types from the System.Web.UI.WebControls namespace |
[ Team LiB ] |