ASP.NET Web Forms Server Controls: A Comprehensive Guide
Explore the various server controls available in ASP.NET Web Forms and how they simplify web development. This guide provides a detailed list of common controls (TextBox, Button, Label, etc.), their properties, events, and functionalities, enhancing your ASP.NET development skills.
ASP.NET Web Forms Server Controls
Introduction to ASP.NET Server Controls
ASP.NET Web Forms provides a rich set of server controls that simplify web development. These controls are processed on the server and generate HTML to be sent to the user's browser. This approach contrasts with client-side controls (like standard HTML elements), which are rendered directly by the browser without server-side processing. Server controls offer several advantages, including event handling, data binding, and state management. This tutorial lists the available ASP.NET server controls.
Types of ASP.NET Server Controls
The following table lists common ASP.NET server controls and their key features. Note that the Applicable Events
column lists some, but not necessarily all, events supported by each control. For a complete list of events, refer to the official Microsoft documentation.
Control Name | Applicable Events | Description |
---|---|---|
Label | None | Displays static text. |
TextBox | TextChanged | Provides a single-line text input field. |
Button | Click, Command | A standard button control that triggers events. |
LinkButton | Click, Command | A button that looks like a hyperlink. |
ImageButton | Click | A button that displays an image. |
HyperLink | None | Creates a hyperlink to another page or resource. |
DropDownList | SelectedIndexChanged | A dropdown list allowing users to select a single option. |
ListBox | SelectedIndexChanged | A list box allowing users to select one or more options. |
DataGrid | Many (see Microsoft documentation) | Displays data in a grid format, supporting features like paging, sorting, and editing (now deprecated). |
DataList | Many (see Microsoft documentation) | Displays data in a non-tabular format. |
CheckBox | CheckedChanged | A checkbox for selecting true/false options. |
CheckBoxList | SelectedIndexChanged | A group of checkboxes. |
RadioButton | CheckedChanged | A radio button for selecting a single option from a group. |
RadioButtonList | SelectedIndexChanged | A group of radio buttons. |
Image | None | Displays an image on the page. |
Panel | None | A container for grouping other controls. |
PlaceHolder | None | A placeholder for dynamically adding controls. |
Calendar | SelectionChanged, VisibleMonthChanged, DayRender | A calendar control for date selection. |
AdRotator | AdCreated | Displays rotating advertisements. |
Table | None | Creates an HTML table. |
XML | None | Displays XML data. |
Literal | None | Displays text; allows for runtime text generation. |