INTRO 

·         <%@ Page Language=”VB” %> Directives are used primarily to provide the compiler with the information it needs to compile the page. 

·         The next part of the page begins with the opening <script runat=”server”> tag and ends with the closing </script> tag. The <script> tag contains something called the code declaration block. The Code Declaration Block contains all the functions and methods of the page.

·         The final part of the page is called the page render block. The page render block contains everything that is rendered to the browser. The majority of the page render block consists of everyday HTML. For example, the page contains the standard HTML <head> and <body> tags.

·         You can add an <%@ Import %> directive to a page to import a particular namespace. For eg. <%@ Import Namespace=”System.Net.Mail” %> If you are using the Namespace in all the pages of your website you can add it in the web.config file.

·         A web configuration file is a special type of file that you can add to your application to configure your application. Be aware that the file is an XML file and, therefore, all the tags contained in the file are case sensitive. You can add a web configuration file to your application by selecting Website, Add New Item and selecting Web Configuration File.

·         An assembly is the actual .dll file on your hard drive where the classes in the .NET Framework are stored. For example, all the classes contained in the ASP.NET Framework are located in an assembly named System.Web.dll. More accurately, an assembly is the primary unit of deployment, security, and version control in the .NET Framework. Because an assembly can span multiple files, an assembly is often referred to as a “logical” dll.

 CONTROLS

·         The first part of the control declaration, the asp: prefix, indicates the namespace for the control. All the standard ASP.NET controls are contained in the System.Web.UI.WebControls namespace. The prefix asp: represents this namespace.

·         All ASP.NET control events happen on the server. For example, the Click event is not raised when you actually click a button. The Click event is not raised until the page containing the Button control is posted back to the server.

·         You can determine how much View State each control contained in a page is consuming by enabling tracing for a page. This includes a trace=”true” attribute in its <%@ Page %> directive, which enables tracing.

 DYNAMIC COMPILATION

·         When you create an ASP.NET page, you are actually creating the source code for a .NET class. You are creating a new instance of the System.Web.UI.Page class. The entire contents of an ASP.NET page, including all script and HTML content, are compiled into a .NET class.

·         When you request an ASP.NET page, the ASP.NET Framework checks for a .NET class that corresponds to the page. If a corresponding class does not exist, the Framework automatically compiles the page into a new class and stores the compiled class (the assembly) in the Temporary ASP.NET Files folder. The next time anyone requests the same page in the future, the page is not compiled again. The previously compiled class is executed and the results are returned to the browser. When the class is added to the Temporary ASP.NET Files folder, a file dependency is created between the class and the original ASP.NET page. If the ASP.NET page is modified in any way, the corresponding .NET class is automatically deleted. The next time someone requests the page, the Framework automatically compiles the modified page source into a new .NET class. This process is called dynamic compilation. Dynamic compilation enables ASP.NET applications to support thousands of simultaneous users. Unlike an ASP Classic page, for example, an ASP.NET page does not need to be parsed and compiled each and every time it is requested. An ASP.NET page is compiled only when an application is modified.

  CODE BEHIND FILE

·         A two-file ASP.NET page is normally referred to as a code-behind page. In a code-behind page, the page code is contained in a separate file.

·         Code-behind pages work in a different way in the ASP.NET 2.0 Framework than they did in the ASP.NET 1.x Framework. In ASP.NET 1.x, the two halves of a code-behind page were related by inheritance. In the ASP.NET 2.0 Framework, the two halves of a code-behind page are related by a combination of partial classes and inheritance.

·         The ASP.NET 2.0 Framework generates three classes whenever you create a code-behind page. The Presentation page and the Code behind file have Partial Classes. There is another class connected to Presentation Page which inherits from the Partial Class. Therefore the Presentation Page has two classes and The Code behind file has one class.

·         The page which contains the HTML controls is called the Presentation Page and the page which contains the Code i.e. the Load method, the event handlers, etc is called the Code behind file.  

·         The difference between these two events is that the Load event happens before any control events and the PreRender event happens after any control events.

·         ASP.NET pages support a feature named AutoEventWireUp, which is enabled by default. If you name a subroutine Page_Load(), the subroutine automatically handles the Page Load event; if you name a subroutine Page_PreRender(), the subroutine automatically handles the Page PreRender event, and so on. 

STANDARD CONTROLS

·         By default, a Label control renders its contents in an HTML <span> tag. Whatever value you assign to the Text property is rendered to the browser enclosed in a <span> tag.

·         The Label control includes a property named the AssociatedControlID property. You can set this property to point at an ASP.NET control that represents a form field. A side benefit of using the AssociatedControlID property is that clicking a label when this property is set automatically changes the form focus to the associated form input field.

·         Because the contents of a Literal control are not contained in a <span> tag, the Literal control does not support any of the formatting properties supported by the <span> tag. For example, the Literal control does not support either the CssClass or BackColor properties.

·         When the AutoPostBack property has the value true, the form containing the TextBox is automatically posted back to the server when the contents of the TextBox changes.

·         The button controls, like most ASP.NET controls, support expando attributes, you can handle other client-side events simply by adding an arbitrary attribute to the control. If the ASP.NET Framework does not recognize an attribute declared on a button control, the framework simply passes the attribute to the browser.

·         The Panel control enables you to work with a group of ASP.NET controls. You can use a Panel control to hide or show a group of ASP.NET controls.

·         Don’t use the values Horizontal or Vertical with the ScrollBars property when you want the scrollbars to appear in browsers other than Microsoft Internet Explorer. If you want the scrollbars to appear in FireFox and Opera, use either the value Auto or Both.

·         The HyperLink control enables you to create a link to a page. Unlike the LinkButton control, the HyperLink control does not submit a form to a server.