PROWAREtech

articles » archived » asp-net » server-controls

ASP.NET: Server Controls

About Web Form Server controls (.NET Framework).

ASP.NET server controls divide into two main categories: HTML Server Controls and Web Server Controls.

HTML Server Controls

HTML server controls are HyperText Markup Language (HTML) page elements that include a runat="server" attribute. They have the same HTML output and properties as their corresponding HTML tags, but include server-side events. Most HTML server controls include an OnServerEvent. For example, the <input type="button"> control has an OnServerClick event. When an ASP.NET page is reposted, HTML server controls keep their values. HTML controls are defined in the System.Web.UI.HtmlControls namespace. The following syntax makes an HTML element into an HTML server control.

<input type="text" id="Text1" runat="server" />

The HTML server controls consist of the:

HtmlAnchor
HtmlButton
HtmlForm
HtmlImage
HtmlInputButton
HtmlInputCheckBox
HtmlInputFile
HtmlInputHidden
HtmlInputImage
HtmlInputRadioButton
HtmlInputText
HtmlSelect
HtmlTable
HtmlTableCell
HtmlTableCell
HtmlTextArea controls

Web Server Controls

Web server controls are similar to HTML server controls except that they have a common set of property names and can be made up of several HTML elements. Web controls are defined in the System.Web.UI.WebControls namespace.

Web server controls are further divided into four subcategories: Basic Web Controls, Validation Controls, List Controls and Rich Controls.

Basic Web Controls

Basic web controls include additional methods, events, and properties against which one can program. The Basic web controls include:

Button Web Server Control
CheckBox Web Server Control
HyperLink Web Server Control
Image Web Server Control
ImageButton Web Server Control
Label Web Server Control
LinkButton Web Server Control
Literal Web Server Control
Panel Web Server Control
PlaceHolder Web Server Control
RadioButton Web Server Control
Table Web Server Control
TableCell Web Server Control
TableRow Web Server Control
TextBox Web Server Control
FileUpload Web Server Control (.NET 2.0)
HiddenField Web Server Control (.NET 2.0)
ImageMap Web Server Control (.NET 2.0)

Validation Controls

Validation controls validate the values entered into other controls on the page. Validation controls perform client-side and server-side validation. Validation controls consist of the following:

RequiredFieldValidator Control
RangeValidator Control
CompareValidator Control
RegularExpressionValidator Control
CustomValidator Control
ValidationSummary Control

The following is a form that uses the RequiredFieldValidator. After pressing the Next button, the users is told which fields are required and the user is not allowed to continue (the form will not post).

ASP.NET RequiredFieldValidator

List Controls

List controls bind to collections and only collections supporting the IEnumerable, ICollection, or IListSource interfaces. List controls expose DataSource and DataMember properties used to bind to collections. List controls consist of the following:

ListBox Web Server Control
CheckBoxList Web Server Control
RadioButtonList Web Server Control
Repeater Web Server Control
DataList Web Server Control
DataGrid Web Server Control
DropDownList Web Server Control
BulletedList Web Server Control (.NET 2.0)

Rich Controls

Rich controls are built with many HTML elements and contain rich functionality. Examples are the Calendar control and the AdRotator control. Rich controls consist of the following:

AdRotator Web Server Control
Calendar Web Server Control
Xml Web Server Control
Wizard Web Server Control (.NET 2.0)

Custom Server Controls

If ASP.NET doesn't have a control that does what the programmer needs then it allows for the creation of custom server controls.


This site uses cookies. Cookies are simple text files stored on the user's computer. They are used for adding features and security to this site. Read the privacy policy.
CLOSE