ASP.NET Web Server Controls:
There are 4 types of controls
1. HTML server controls :
HTML server controls are HTML elements (or elements in other supported markup, such as XHTML) containing attributes that make them programmable in server code. By default, HTML elements on an ASP.NET Web page are not available to the server. Instead, they are treated as opaque text and passed through to the browser. However, by converting HTML elements to HTML server controls, you expose them as elements you can program on the server.
The object model for HTML server controls maps closely to that of the corresponding elements. For example, HTML attributes are exposed in HTML server controls as properties.
Any HTML element on a page can be converted to an HTML server control by adding the attribute runat="server". During parsing, the ASP.NET page framework creates instances of all elements containing the runat="server" attribute. If you want to reference the control as a member within your code, you should also assign an id attribute to the control.
The page framework provides predefined HTML server controls for the HTML elements most commonly used dynamically on a page: the form element, the input elements (text box, check box, Submit button), the select element, and so on. These predefined HTML server controls share the basic properties of the generic control, and in addition, each control typically provides its own set of properties and its own event.
HTML server controls offer the following features:
i. An object model that you can program against on the server using familiar object-oriented techniques. Each server control exposes properties that enable you to manipulate the control's markup attributes programmatically in server code.
ii. A set of events for which you can write event handlers in much the same way you would in a client-based form, except that the event is handled in server code.
iii. The ability to handle events in client script.
iv. Automatic maintenance of the control's state. When the page makes a round trip to the server, the values that the user entered into HTML server controls are automatically maintained and sent back to the browser.
v. Interaction with ASP.NET validation controls so you can verify that a user has entered appropriate information into a control.
vi. Data binding to one or more properties of the control.
vii. Support for styles if the ASP.NET Web page is displayed in a browser that supports cascading style sheets.
viii. Pass-through of custom attributes. You can add any attributes you need to an HTML server control and the page framework will render them without any change in functionality. This enables you to add browser-specific attributes to your controls.
2. Web server controls:
Web server controls are a second set of controls designed with a different emphasis. They do not necessarily map one-to-one to HTML server controls. Instead, they are defined as abstract controls in which the actual markup rendered by the control can be quite different from the model that you program against. For example, a RadioButtonList Web server control might be rendered in a table or as inline text with other markup.
Web server controls include traditional form controls such as buttons and text boxes as well as complex controls such as tables. They also include controls that provide commonly used form functionality such as displaying data in a grid, choosing dates, displaying menus, and so on.
Web server controls offer all of the features described above for HTML server controls (except one-to-one mapping to elements) and these additional features:
i. A rich object model that provides type-safe programming capabilities.
ii. Automatic browser detection. The controls can detect browser capabilities and render appropriate markup.
iii. For some controls, the ability to define your own layout for the control using Templates.
vi. For some controls, the ability to specify whether a control's event causes immediate posting to the server or is instead cached and raised when the page is submitted.
v. Support for themes, which enable you to define a consistent look for controls throughout your site. For details, see ASP.NET Themes and Skins.
vi. Ability to pass events from a nested control (such as a button in a table) to the container control. The controls use syntax such as the following:
<asp:button attributes runat="server" id="Button1" />
3. Validation controls:
Controls that incorporate logic to enable you to what users enter for input controls such as the TextBox control. Validation controls enable you to check for a required field, to test against a specific value or pattern of characters, to verify that a value lies within a range, and so on. For more information, see ASP.NET Validation Controls.
4. User controls :
Controls that you create as ASP.NET Web pages. You can embed ASP.NET user controls in other ASP.NET Web pages, which is an easy way to create toolbars and other reusable elements. For more information, see ASP.NET User Controls.