Week-02

=Week 02=

**Distinguish between web server controls, HTML server controls, and validation controls.**
When you create ASP.NET Web pages, you can use these types of controls: >
 * 1) **HTML server controls** HTML elements exposed to the server so you can program them. HTML server controls expose an object model that maps very closely to the HTML elements that they render.
 * 1) **Web server controls** Controls with more built-in features than HTML server controls. Web server controls include not only form controls such as buttons and text boxes, but also special-purpose controls such as a calendar, menus, and a tree view control. Web server controls are more abstract than HTML server controls in that their object model does not necessarily reflect HTML syntax.
 * 2) **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.
 * 3) **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

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**

HTML server controls offer the following features: 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:
 * 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.
 * 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.
 * The ability to handle events in client script.
 * 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.
 * Interaction with ASP.NET validation controls so you can verify that a user has entered appropriate information into a control.
 * Data binding to one or more properties of the control.
 * Support for styles if the ASP.NET Web page is displayed in a browser that supports cascading style sheets.
 * 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.
 * Web Server Controls**
 * A rich object model that provides type-safe programming capabilities.
 * Automatic browser detection. The controls can detect browser capabilities and render appropriate markup.
 * For some controls, the ability to define your own layout for the control using Templates.
 * 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.
 * Support for themes, which enable you to define a consistent look for controls throughout your site. For details, see ASP.NET Themes and Skins.
 * Ability to pass events from a nested control (such as a button in a table) to the container control.
 * **Validation Server Control** || **Description** ||
 * CompareValidator || Compares the value of one input control to the value of another input control or to a fixed value ||
 * CustomValidator || Allows you to write a method to handle the validation of the value entered ||
 * RangeValidator || Checks that the user enters a value that falls between two values ||
 * RegularExpressionValidator || Ensures that the value of an input control matches a specified pattern ||
 * RequiredFieldValidator || Makes an input control a required field ||
 * ValidationSummary || Displays a report of all validation errors occurred in a Web page ||

===Describe the use of the AutoPostBack, CausesValidation, and EnableViewState properties for a web server control. Describe the use of the Load event for a web page. Describe the use of the IsPostBack and IsValid properties for a web page. Describe the use of the Click, TextChanged, CheckedChanged, and SelectedIndexChanged events for a web server control. Describe how the HTML that’s sent to a browser handles view state and user input.===