Controls in ASP.NET



HTML controls: 

These Controls Will run at client side

We can also make HTML control to run at server side by adding runat=”server”

HTML Server Control   .html
<html>
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
 <p><input id="Button1" type="button" value="button" /></p>
</body>
</html>

HTML control do not require any rendering, so execution will be faster

ASP.Net standard controls:

  • All Asp.Net standard Controls will RunAt Server Side
  • Every Asp.Net Control has a special class available in 
          system.web.UI.webControls NameSpace
  • To create any ASP.Net standard control we use the following syntax
  • Syntax: <tagprefix: pagename ID=”AnyID” runat=”server”/>
          EX: <asp:Textbox   ID=”T1”  runat=”server”/>
            <asp:Button   ID=”T1”  runat=”server”/>

  • Any control we create on the web page like Button1 Button2 Button3………… are object of  Button Class. Textbox1,Textbox2, Textbox3 are Objects of Textbox Class etc..
  • For any ASP.Net standard Control Equivalent HTML code is generated on Rendering
  • All ASP.Net Controls will provide State Management
Difference between HTML code ASP.Net standard controls

SNO
HTML Control
ASP.Net Standard Control
01
Will runat Client side
Will runat server side
02
Can be made to runat server side by adding runat=”server” attribute
Cannot be made to run at client side
03
HTML controls do not contains any class, so we cannot provide object oriented programming features
Every Asp.net control contains a separate class, so we can provide object oriented programming features
04
Do not provide state management
Provide state management
05
No rendering is required
Rendering is Required
06
Execution is faster
Execution is slow
  
Code Execution Process in ASP.NET:-



Step1: client sends request for the required page to the IIS

Step2: IIS will located the requested file
                 If requested file is not found IIS will delivered error message to the client otherwise if requested file is found remaining steps will be performed

Step 3: Located file is submitted to the aspx engine which SAPI.dll     
         
Step 4: Aspx engine will separate client side code as well as server side code on the generate page class file by adding the required methods to execute the server side code

Step5: This page class file is submitted to the compilers

Step6: Compilers will compile the code and will generate MSIL code
(If pre compilation is made step4 & step5 & step6 will be avoided)

Step7: MSIL code is submitted to CLR i.e. Common Language Runtime here CLR will perform three steps

  1.    Instantiating
     2.     Processing 

     3.     Rendering
  • Instantiation means create object to the respective page
  • Processing means execute the server side code
  • Rendering means converts this server side code into client understandable format i.e. Html & Javascript
Step 8: All this will be stored as an execution result

Step9: This execution result is sent to IIS

Step10: IIS will delivered the execution result to the client once execution result is delivered to the client result


No comments:

Post a Comment