
72
|
Chapter 5: ASP.NET Server Controls
This is the Title of the Book, eMatter Edition
Copyright © 2008 O’Reilly & Associates, Inc. All rights reserved.
The attributes of an HTML tag correspond to the properties of the HTML
control. The HTML controls are declared by using the standard HTML tags with
the attribute
runat="server". For example:
<input type="text" id="txtName" runat="server">
The id attribute is very important for all server controls if you plan
to access your control programmatically, since it defines the name
by which the object will be referenced in code.
In ASP.NET, the following HTML tags are supported as HTML controls:
<a>
<img>
<form>
<table>
<tr>
<th>
<td>
<select>
<textarea>
<button>
All <input> tags
You can declare other HTML tags as server-side controls by using the
runat="server" attribute/value pair. However, these controls are not supported;
instead, unsupported HTML elements are handled by a generic super HTML
server control called HtmlGenericControl. The HTML elements you might typi-
cally handle in this way include
<div>, <span>, <body>, and <font>.
Web Controls
One of the challenges in developing web applications is that of providing support
for different browsers that have different capabilities, proprietary extensions to
HTML, and support for different scripting languages, while maintaining the
desired level of functionality and consistency. The only way to render content
consistently ...