Before creating something new with wood and nails, a carpenter needs to be familiar with the tools at hand. The same is true for working with ASP.NET. Before looking at any more code samples, you should be familiar with the tools that are available to help you create extremely powerful web applications. These tools come in the form of ASP.NET controls that ship with version 2.0 of the .NET Framework. These controls are all briefly described in Table 22.3 according to the category in which they appear on the ASP.NET 2005 Toolbox pane. The Web Part controls are not included in this table, as they will be covered in much more detail in Chapter 26, "Introduction to Web Parts."
Table 22.3. Stock ASP.NET Controls
Control | Description |
---|
Standard Controls | |
Label | The label is just that: simple text used to label other interface elements. |
TextBox | An input box. |
Button | A standard button. |
LinkButton | A button that renders as a hyperlink. |
ImageButton | An image that responds to clicks. |
CheckBox | A standard check box. |
CheckBoxList | A list of check boxes. |
RadioButton | A single radio button. |
RadioButtonList | A list of radio buttons, allowing only one item in the list to be selected at any time. |
Image | An image. |
ImageMap | A clickable image map with defined regions. |
Table | A standard table, rendering as the HTML <table> tag. |
BulletedList | Renders as a <bl> and its associated list items. |
HiddenField | Creates a hidden form field, the value of which you can control with server-side properties. |
Literal | Renders whatever raw markup you place in its Text Property. |
Calendar | Renders an interactive calendar that defaults to displaying today's date. |
AdRotator | A component used for displaying a rotating list of advertising banners or images on a page. |
FileUpload | A component used for uploading files to the web server. Exposes the uploaded file as a property containing a Stream object. |
Wizard | Controls the display of a sequence of multiple panels of information rendered in traditional "'Wizard"' format. |
Xml | Control responsible for rendering either raw XML or XSLT-transformed XML to a Page. |
MultiView | Container control for multiple View controls, each of which contains a discrete interface containing labels, buttons, and so on. Used to dynamically choose which view to display based on criteria such as state, user identity, or permissions. |
Panel | A container for child controls that can be toggled visible or hidden dynamically. |
PlaceHolder | A placeholder control. You can use it to "'take up space"' at design time and then fill it dynamically at runtime with child controls or raw HTML. |
View | A control that contains child controls to render a subportion of user interface. Used in combination with the MultiView control to dynamically render different views based on criteria such as state or user identity. |
Substitution | A powerful control that allows you to dynamically integrate dynamic content into cached page output. |
Localize | A control very similar to Literal, but designed to render localized content. |
Data Controls | |
GridView | A full-featured control for displaying a grid of data. |
DataList | A control that renders a list of data, the look and feel of which is controlled via templates. |
DetailsView | A control designed to render a details form. |
FormView | Control designed to a render a form. |
Repeater | A low-level control for rendering a list of data. |
SqlDataSource | A component used to connect to SQL Server. |
AccessDataSource | Component used to connect to MS Access. |
ObjectDataSource | Component used to bind controls to an object. |
XmlDataSource | Component used to bind controls to an XML source. |
SiteMapDataSource | Component allowing binding to a site map. |
ReportViewer | Component designed for displaying data in a report format. |
Navigation Controls | |
SiteMapPath | Essentially a "'bread crumb"' control for displaying a user's location within a site map. |
Menu | Control for rendering an interactive menu. |
treeView | Control for rendering an interactive tree. |
Validation Controls | |
RequiredFieldValidator | Use this to force a field to have data. |
RangeValidator | Use this to require a field to have data within a specified range. |
RegularExpressionValidator | Forces an input control's data to match a given regular expression for validating things like phone numbers, e-mail addresses, and so on. |
CompareValidator | Forces an input control's data to compare in a specific way to another control's data. |
CustomValidator | Allows you to write your own validation routine for a given control's data. |
ValidationSummary | Control that displays a summary of all validation failures or indication of success on a given page. |
Authentication Controls | |
Login | Control that facilitates user authentication. |
LoginView | Renders different views based on user authentication status. |
PasswordRecovery | Control used to facilitate password recovery. |
LoginStatus | Displays user's logged-in status. |
LoginName | Displays user's logged-in name. |
CreateUserWizard | Wizard control for creating a new user. |
ChangePassword | Control allowing user to change password. |
HTML Controls (for use only when ASP control is insufficient) | |
Input (Button) | A traditional HTML input button. |
Input (Reset) | A traditional HTML form reset button. |
Input (Submit) | A form submit button. |
Input (Text) | A text input control. |
Input (File) | An HTML file upload control. |
Input (Password) | A password text entry box. |
Input (Checkbox) | A checkbox input control. |
Input (Radio) | A radio button input control. |
Input (Hidden) | A hidden form value control. |
Textarea | A multirow text input box. |
Table | A traditional HTML table control. |
Image | A traditional HTML image control. |
Select | A select box. |
Horizontal Rule | An <hr> tag. |
Div | A <div> tag. |