Different Directives for Dot NET

Computers & TechnologyWeb Hosting

  • Author Jessica Woodson
  • Published June 7, 2010
  • Word count 395

Directives are those that are responsible for any kind of change in the settings that decide the actions of an entire page. They are language specific and for .NET they function as settings of the parser and compiler. They can be used anywhere in a page, but in most of the cases it is best to use them in the beginning of the page for best results. Directives are used in both .aspx files (ASP.NET pages) and .ascx files (user control pages).

Let see some of the main kinds of Directives used:

@Page directive:

This is used to define page specific attributes used by ASP.NET page parser and compiler. It can be included only in .aspx files and it also defines the language of the page just like c# and VB.

@Control:

This works much in the same way except that it is used specifically for User Controls. Also included only in .aspx and they control the view state of the page.

@Import:

This one is used to import a namespace into a page or user space. But one directive can import any one namespace only and if there is a need to import more than one then multiple directives will have to be used.

@Implements:

It shows whether the current page or a particular user control follows the specified .NET framework interface or not.

@Register:

This one is a powerful tool which is used to create dynamically creating tags that represent your user controls. It helps to create a tag name and tag prefix to which all the user controls are associated and can be dropped onto a page by just one single simple tag.

@Assembly:

This is used to link an assembly to an application or a web page at parse time. It is contained in either global.asax file, for application-wide linking, or in a page (.aspx) or user control (.ascx) file, for linking to a specific page or user control. Each of these assembly directives can have multiple attribute or value pairs.

@OutputCache:

The OutputCache directive controls output caching for a page or user control.

@Reference:

This one allows you to know that you another page or user control has to be connected with the current page. This gives you access to the controls on the linked page and user control as a part of the Control Collection object.

IndiaNIC, LLC

1285, Montecito Ave #43,

Mountain View,

CA – 94043

Tel: (603) 320-8407

Tel : ( 707) 234-5607

Fax : ( 415 ) 520-9356

Article source: https://articlebiz.com
This article has been viewed 512 times.

Rate article

Article comments

There are no posted comments.

Related articles