Sunday, January 25, 2015

ASP.NET Server Controls

ASP.NET provides a server-side object-oriented and event programming model for the web through server controls.Server controls are objects placed in the ASP.Net pages that are processed by ASP.Net runtimeEach controls has properties, methods, and events.Developers design pages through manipulating these objects and their properties, methods, and events.
 


Features of Server Controls :- The various features of ASP.Net server controls are as follows.
  • Object-oriented programming style. 
  • Desktop application user interface development style for Web pages. 
  • Output is automatically generated, and customized based on the capabilities of the browser. 
  • Ability to react to events. 
  • Automatic state management.

Types of Server Controls :- There are five types of server controls. All five of these different types of controls can be used within a single given Web form.
    1.    HTML server controls
    2.    Web server controls
    3.    Validation server controls
    4.    User controls
    5.    Custom server controls.

1-   HTML Server Controls :-Most standard HTML tags can be turned into HTML server controls simply by adding the runat="server"attribute.This runat attribute indicates that the element is to be processed on the server.

2-    Web server controls :-Web server controls are also created on the server and they require a  runat="server" attribute to work.
          <asp:Button ID="myButton" runat="server" />
Some Web server controls represent traditional HTML form elements such as buttons and drop-down lists.Other Web server controls represent more complex or abstract elements such as calendars, data lists, data sources, and tree views. These more complex Web server controls do not necessarily map one-to-one (or even at all) to any existing HTML tags and can in fact be realized by dozens if not hundreds of HTML tags and many lines of Javascript code.

3-   Validation Server Controls :- These controls allow you to test a user’s input for validity. They are actually a special type of Web server control. Validation controls encapsulate common user input validation checks required by most Web applications:
  •   ensuring that a required field is not empty,
  •   comparing an input value against another value,
  •    checking if a value falls within a range,
  •    verifying that an input value matches a given pattern.

   4-   User Controls :- These are developer-created controls that use the same programming techniques used to write Web forms pages.They typically allow the encapsulation of the functionality of multiple server controls along with other ASP.NET or HTML content in a single unit.

   5-   Custom Server Controls :- A custom server control is a Web server control that you can create. A custom control is a compiled class and may combine multiple existing server controls.A custom control, unlike a user control, contains no declarative elements, and can be extended, use templates, support data binding, and be redistributed in a precompiled assembly.

0 comments:

Post a Comment

Blog Archive