What is a Directive in ASP.Net?

chinmay.sahoo

New member
Directives specify settings that are used by the page and user-control compilers when the compilers process ASP.NET Web Forms pages and user control files. There are 11 types of directives in asp.net and are as follows


• @Page - Enables you to specify attributes and val es for an Asp.Net Page to be used when the page is parsed and compiled.

• @Master - It is quite similar to the Page directive. The Master directive belongs to Master Pages that is

.master files.

• @Control - It is used when we build an Asp.N t us r controls. The @Control directive helps us to define the properties to be inherited by the us r control. Th se values are assigned to the user control as the page is parsed and compiled.

• @Register - Associates aliases with namespaces and classes, which allow user controls and custom server controls to be ren ered when inclu ed in a requested page or user control.

• @Reference - Links a page, user control, or COM control to the current page or user control declaratively.

• @PreviousPageType - Creates a strongly typed reference to the source page from the target of a cross-page posting.

• @OutputCache - It controls the output caching policies of the Asp.Net page or user control.

• @Import - Imports a namespace into a page or user control explicitly.

• @Implements - It gets the Asp.Net page to implement a specified .NET framework interface.

• @Assembly - It is used to make your ASP.NET page aware of external components.

• @MasterType - To access members of a specific master page from a content page, you can crea e a strongly typed reference to the master page by creating a @MasterType directive.
 
Back
Top