The ASP.NET server controls are listed here according to general function. The following sections individually provide details about Web server controls, HTML server controls, and validation controls.
Note For more about the differences between Web and HTML server controls, see Introduction to ASP.NET Server Controls.
Web Server Controls
Web server controls include traditional user-entry controls as well as special-purpose controls such as a calendar. All Web server controls can be bound to a data source.
Note You can also create output for mobile devices. To do so, you use the same ASP.NET page framework, but you create Mobile Web Forms instead of Web Forms pages and use controls specifically designed for mobile devices. For details, see Creating ASP.NET Mobile Web Applications.
The Web server controls are listed below according to their function.
Security Note User input in a Web Forms page can include potentially malicious client script. By default, the Web Forms page validates that user input does not include script or HTML elements. For more information, see Scripting Exploits and Protecting Against Script Exploits in a Web Application.
| Function | Control | Description |
| Text display (read only) | Label | Displays text that users cannot directly edit. |
| Text edit | TextBox | Displays text that can be edited by users at run time or changed programmatically. |
| Selection from a list | DropDownList | Allows users to select from a list that appears when the user clicks a button. |
| | ListBox | Displays a list of choices. Optionally, the list can allow multiple selections. |
| Graphics display | Image | Displays an image. |
| | AdRotator | Displays a sequence (predefined or random) of images. |
| Value setting | CheckBox | Displays a box that users can click to turn on and off. |
| | CheckBoxList | Creates a grouping of check boxes. The list control makes it easy to create check boxes using data binding. |
| | RadioButton | Displays a single button that can be turned on or off. |
| | RadioButtonList | Creates a grouping of radio buttons. Inside the group, only one button can be selected. |
| Date setting | Calendar | Displays a graphic calendar to allow users to select a date. |
Commands
Note These controls always cause the form to be posted to the server for processing. | Button | Performs a task. |
| | LinkButton | Like a Button control, but has the appearance of a hyperlink. |
| | ImageButton | Like a Button control, but incorporates an image instead of text. |
| Navigation | HyperLink | Creates a Web navigation link. |
| Table manipulation | Table | Creates a table. |
| | TableCell | Creates an individual cell within a table row. |
| | TableRow | Creates an individual row within a table. |
| Grouping other controls | CheckBoxList | Creates a collection of check boxes. |
| | Panel | Creates a borderless division on the form that serves as a container for other controls. |
| | RadioButtonList | Creates a grouping of radio buttons. Inside the group, only one button can be selected. |
| Selection from a list | Repeater | Displays information from a data source using a set of HTML elements and controls you specify, repeating the elements once for each record in the data set. |
| | DataList | Like the Repeater control, but with more formatting and layout options, including the ability to display information in a table. The DataList control also allows you to specify editing behavior. |
| | DataGrid | Displays information, usually data-bound, in tabular form with columns. Provides mechanisms to allow editing and sorting. |
| Place holding | PlaceHolder | Enables you to place an empty container control in the page and then dynamically add child elements to it at run time. |
| | Literal | Renders static text into a Web page without adding any HTML elements. |
| | XML | Reads XML and writes it into a Web Forms page at the location of the control. |
HTML Server Controls
HTML server controls map directly to HTML elements. The controls listed in this section are predefined controls. However, any HTML element can be made into a control; in that case, the control supports a generic set properties and methods. All HTML server controls can be bound to a data source.
| Function | Control | Description |
| Forms | HtmlForm | Defines an HTML form. The values of controls within the form are posted to the server when the form is submitted. |
| Text edit | HtmlInputText | Displays text that can be edited by users at run time, or changed programmatically. |
| | HtmlTextArea | Displays large quantities of text. Used for multi-line text entry and display. |
Commands
Note These controls always cause the form to be posted to the server for processing. | HtmlAnchor | Enables Web navigation. |
| | HtmlButton | Performs a task. This control can contain any arbitrary HTML, and therefore it is very flexible in look and feel. However, it is not compatible with all browsers. |
| | HtmlInputButton | Performs a task. This button is supported on all browsers. |
| | HtmlInputImage | Like a button, but displays a graphic. |
| Selection from a list | HtmlSelect | Displays a list of text and graphical items (icons). |
| Graphics display | HtmlImage | Displays an image. |
| Information storage | HtmlInputHidden | Stores state information for a form (information that needs to be available with each round trip to the server). |
| Navigation | HtmlAnchor | Creates a Web navigation link. |
| Value setting | HtmlInputCheckbox | Creates a box that users can click to turn on and off. The CheckBox control includes a label. |
| | HtmlInputRadioButton | Displays a button that can be turned on or off. Radio buttons are typically used to allow the user to select one item from a short list of fixed options. |
| Table manipulation | HtmlTable | Creates a table. |
| | HtmlTableRow | Creates an individual row within a table. |
| | HtmlTableCell | Creates an individual cell within a table row. |
| File transfer | HtmlInputFile | Allows users to specify files to upload to a server. (The server must allow uploads.) |
| Other functions | HtmlGenericControl | Creates a basic object model (properties, methods, events) for any HTML element converted to a control. |
Validation Controls
Validation controls provide you with a way to check user input in Web or HTML server controls. The following table lists the type of validation controls you can use in Web Forms. For more details, see Web Forms Validation.
| Type of validation | Control to use | Description |
| Required entry | RequiredFieldValidator | Ensures that the user does not skip an entry. |
| Comparison to a value | CompareValidator | Compares a user's entry against a constant value or a property value of another control using a comparison operator (less than, equal, greater than, and so on). |
| Range checking | RangeValidator | Checks that a user's entry is between specified lower and upper boundaries. You can check ranges within pairs of numbers, alphabetic characters, and dates. Boundaries can be expressed as constants or as values derived from another control. |
| Pattern matching | RegularExpressionValidator | Checks that the entry matches a pattern defined by a regular expression. This type of validation allows you to check for predictable sequences of characters, such as those in social security numbers, e-mail addresses, telephone numbers, postal codes, and so on. |
| User-defined | CustomValidator | Checks the user's entry using validation logic that you code yourself. |
| None | ValidationSummary | Displays the error messages of all other validation controls on the page in a single unified summary. |
See Also
Creating and Programming ASP.NET Server Controls | ASP.NET Server Controls Recommendations | Web Forms Validation