The Web Forms controls are listed here according to general function. The following sections individually provide details about Web controls and HTML controls.
Note For more about the differences between Web and HTML controls, see Web Forms Server Controls.
Web controls include traditional user-entry controls as well as special-purpose controls such as a calendar. All Web controls can be bound to a data source. To find properties that are available to all Web controls, see Base Web Control Properties. To find style properties that are supported by some Web controls, see Style Object Properties.
Function | Control | Description |
---|---|---|
Text display (read only) | Label | Displays text that users can't directly edit. |
Text edit | TextBox | Displays text entered at design time that can be edited by users at run time or changed programmatically.
Note Although other controls allow users to edit text (for example, DropDownList), their primary purpose is not usually text editing. |
Selection from a list | DropDownList | Allows users to either select from a list or enter text. |
ListBox | Displays a list of choices. Optionally, the list can allow multiple selections. | |
Graphics display | Image | Displays an image. |
AdRotator | Displays a sequence (pre-defined 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 cause the form to be posted to the server for processing. |
Button | Used to perform 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 controls | Hyperlink | Creates Web navigation links. |
Table controls | 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. | |
List controls | Repeater | Displays information from a data set 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. |
HTML controls map directly to HTML elements. The controls listed in this section are pre-defined 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 controls can be bound to a data source. To find properties that are shared by all HTML controls, see
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 | Can be blank or display text entered at design time that can be edited by users at run time, or changed programmatically. This control can also be used to create password boxes that display their values as asterisks (*). |
HtmlTextArea | Displays large quantities of text. Used for multi-line text entry and display. | |
Commands
Note These controls cause the form to be posted to the server for processing. |
HtmlAnchor | Creates Web navigation. |
HtmlButton | Performs a task. This control can contain any arbitrary HTML, and therefore 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 row within a table row. | |
File transfer | HtmlInputFile | Allows users to specify files to be uploaded 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 provide a way to ensure that users enter appropriate data into a Web Forms page. You can apply one or more of the validation controls listed in the following table to any Web control or HTML control.
Function | Control | Description |
---|---|---|
Required entry | RequiredFieldValidator | Ensures that the user does not skip an entry. |
Comparison to a value (including database fields) | 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). To check against a database field, for the comparison value you specify an expression that gets the data to compare against. |
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. This type of validation allows you to check for values derived at run time. |
See Also