Chapter 9A. Server Controls in Web Forms

In the ASP.NET Web Forms framework, a server control is a special type of control that is processed on the server and participates in the same life cycle as the Web Form. Its job is both to render HTML and JavaScript to the browser. Microsoft Visual Web Developer 2010 Express comes with dozens of server controls for performing common tasks such as displaying data, collecting data, submitting data, and validating data. Some of the server controls map 1-1 with HTML elements, but most of them are much more complex. Also, many, many libraries of server controls can be obtained from third parties.

In this lesson I introduce the different categories of server controls, show you the markup that is generated by some of the server controls, show you how to use some of the server controls, and show you how programmatically to update a property of a server control. I cover both simple and complex server controls.

SERVER CONTROL CATEGORIES

The server controls are conveniently located in the Toolbox and are divided into categories via separate tabs in the Toolbox, as shown in Figure 9A-1.

Note

You can open the Toolbox by selecting Toolbox from the View menu or using the Ctrl+Alt+X key combination.

The following is information about each of the categories of server controls that are provided in the Toolbox:

  • Standard — These are the standard controls. Some of the standard controls that you will use quite often are Label, Button, TextBox, and DropDownList. I show ...

Get ASP.NET 4 24-Hour Trainer now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.