ASP.NET Server Controls

The primary control type used in ASP.NET is the ASP.NET server control. Server controls may have methods and event handlers associated with them, and this code is processed on the server. (Some server controls provide client-side script as well, but even then the processing is done, again, on the server.)

If the control has a visual component (e.g., labels, buttons, and tables), ASP.NET renders classic HTML to the browser, taking the target browser capabilities into account. If the ASP.NET server control requires client-side script to implement its functionality, for example, with the validation controls described in Chapter 11, browser-appropriate script is generated and sent to the browser. However, server-side validation will be performed as well.

Tip

This is a key point and bears repeating: what is sent to the client is plain vanilla HTML, so ASP.NET programs can be run on any browser by any manufacturer. All processing is done on the server, and all ASP.NET server controls are presented to the browser as standard HTML. Sending script is an optimization and is never required.

ASP.NET server controls offer a consistent programming model. For example, in HTML, the input tag (<input>) is used for buttons, single-line text fields, checkboxes, hidden fields, and passwords. For multiline text fields, you must use the <textarea> tag. With ASP.NET server controls, each different type of functionality corresponds to a specific control. For example, all text is entered ...

Get Programming ASP.NET 3.5, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.