Friday, July 27, 2012

ASP.NET Directives


ASP.NET pages actually support eight different directives.
  • @ Page
  • @ Control
  • @ Import
  • @ Implements
  • @ Register
  • @ Assembly
  • @ OutputCache
  • @ Reference
Page directives are the most commonly used directives, and are used to edit a wide variety of settings that control how the page parser and page compiler work. The following is a list of some of the more commonly used page directive attributes in ASP.NET.
 Example:
@ Page language="c#" Codebehind="WebForm1.aspx.cs"
         AutoEventWireup="false" Inherits="TestWebApp.WebForm1"

  • Language indicates the language in which the inline script code within the ASP.NET page is written (the code between <% %> tags). The value of this attribute can be C#, VB, or JS.
  • Codebehind indicates the name of the file being used as the code supporting this ASP.NET page. This file should reflect the Language setting; that is, if the language being used is C#, the CodeBehind file should have a .cs extension and be written in C#.
  • Inherits indicates a qualified class from which this ASP.NET page should inherit. Generally, this will be the name of the class described in the code-behind file.
  • AutoEventWireup is a Boolean attribute that indicates whether the ASP.NET pages events are auto-wired.


No comments:

Post a Comment