The web server controls are similar to the
HTML controls in many ways, however they may represent more complex elements, instead of
mapping directly to existing HTML tags. To see a list of them we can bring up the
Toolbox in Visual Studio and expand the standard controls. As we can see ASP.NET has a large
number of web controls available. To add one we can simply drag and drop the
control where we want it placed. Double clicking also works to position it wherever the caret
is located. Although this list do contain some rich controls
such as the calendar, it seems as first glance that many of the simpler web controls overlap
with the HTML controls. For example there’s no functional difference
between a web button control and its HTML control counterpart, they are both server
side controls for the button element. This is really more of a convenience feature.
The purpose of the HTML Server Controls is to make it easier to migrate an HTML page
to ASP.NET. Whereas the web controls have more relation
to the .NET Framework, so they offer more control from a programming standpoint. If we check the properties of the web control
we can see they differ greatly from those of the HTML control.
To get a better overview of the properties we’ll switch over to design mode and bring
out the properties window. With the web button now selected we can see all the properties
that this web control has available. This is a great way to learn about the functionality
of the web controls. For example if we added a checkbox, we would
quickly discover that its state was determined by the Checked property.
If we changed its default state to true in the properties window, the editor would add
that property to the control. The property could of course just as well
be used from the code page, both to get the property and to set it.