ASP.NET @ Page directive
Every ASP.NET generally begins with the @ Page directive. This defines page-specific attributes used by the ASP.NET page parser and compiler and can be included only in .aspx files. By default, Visual Studio creates a page directive as shown below (when you use the default web application template):<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>
Specifies a title for the page that is rendered within the HTML <title> tags in the response. The title can also be accessed programmatically as a property of the page.
Specifies the language used when compiling all inline rendering (<% %> and <%= %>) and code declaration blocks within the page. Values can represent any .NET Framework-supported language, including Visual Basic, C#, or JScript. Only one language can be used and specified per page.
Sets the path to the master page for the content page or nested master page. Supports relative and absolute paths.
Indicates whether the page's events are autowired. true if event autowiring is enabled; otherwise, false.
Specifies the name of the compiled file that contains the class associated with the page. This attribute is not used at run time. This attribute is used for Web application projects. The CodeFile attribute is used for Web site projects.
Defines a code-behind class for the page to inherit. This can be any class derived from the Page class. This attribute is used with the CodeFile attribute, which contains the path to the source file for the code-behind class. The Inherits attribute is case-sensitive when using C# as the page language, and case-insensitive when using Visual Basic as the page language.
Specifies the algorithm to use to generate ClientID values for controls. The default value is Predictable. The default value for controls is Inherit. Therefore, the default algorithm for controls in a page is determined by the ClientID setting of the page. A different default value can be set in the pages element of the Web.config file. For more information about the algorithms, see the ClientIDMode class.
Defines the HTTP content type of the response as a standard MIME type. Supports any valid HTTP content-type string.
Enables validation of events in postback and callback scenarios. true if events are being validated; otherwise, false. The default is true.
Defines session-state requirements for the page. true if session state is enabled; ReadOnly if session state can be read but not changed; otherwise, false. The default is true. These values are case-insensitive.
Specifies whether view state is maintained across page requests. This value is true if view state is maintained, or false if view state is not maintained. The default is true.

0 comments:
Post a Comment