1. ASP.NET Introduction 2. Comp of .Net Framework 3.5 3. Sys.Req for VS 2008 4. ASP.NET Envrmnt Setup 5. VS2010 Ultimate Sys.Req 6. Installing VS 2010 7. VS 2012 Sys.Req 8. Installing VS Exp 2012 9. Start the VS 2008 10. Application Life Cycle 11. Page Life Cycle 12. Page Life Cycle Events 13. ASP.NET Example 14. Event Handling 15. Default Events 16. Server Side 17. Request Object 18. Response Object 19. Server Controls 20. Server Controls Properties 21. Server Controls Methods 22. HTML Server Controls 23. Client Side 24. ASP.NET Basic Controls 25. TextBox Control 26. CheckBox Controls 27. RadioButton Controls 28. ListBox Control 29. HyperLink Control 30. Image Control 31. BulletedList Control 32. ASP.NET Directives 33. Implements Directive 34. Master Type Directive 35. Page Directive 36. PreviousPage Type 37. Managing State 38. Control State 39. Cookies 40. Query Strings 41. Server-Side State 42. Session State 43. Validation Controls 44. Required FieldValidator 45. Range Validator 46. Compare Validator 47. RegularExpressionValidator 48. Custom Validator 49. Validation Summary 50. Data Source Control 51. AdRotator Control 52. Calendar Control 53. Calendar Control Example 54. Panel Control 55. Panel Control Example 56. Multi Views Control 57. MultiView & View controls 58. MultiView Control Example 59. FileUpload Control 60. FileUpload Control Eg 61. AJAX Control 62. UpdatePanel control 63. UpdateProgress Control 64. Custom Controls 65. Custom Control Eg 66. Personalization 67. Create Simple Profile 68. ADO.NET 69. ADO.NET Objects 70. DataTable 71. DataRow 72. DataColumn 73. Object Example 74. Error Handling 75. Tracing Errors 76. Debugger 77. Security 78. Authentication 79. Authorization 80. LINQ 81. LINQ Query Operators 82. LINQ Example 83. Caching 84. Data Caching 85. Output Caching 86. Object Caching 87. Web Services 88. Create Web Services Eg 89. Web & Machine.config 90. Settings Schema 91. ASP.NET Deployment 92. XCopy Deployment 93. Web Setup Project 94. ASP Interview Part 1 95. ASP Interview Part 2 96. ASP Interview Part 3 97. ASP Interview Part 4 98. ASP Interview Part 5 99. ASP Interview Part 6
Pr.Pg Next Pg

ASP.NET Directives tutorials

  • Directives specify settings that are used by the page and user-control compilers when the compilers process ASP.NET Web Forms pages (.aspx files) and user control (.ascx) files.

  • ASP.NET treats any directive block (<%@ %>) that does not contain an explicit directive name as an @ Page directive (for a page) or as an @ Control directive (for a user control).

  • The following table shows the list of directives and descriptions:




@ Assembly

Links an assembly to the current page or user control declaratively


Defines control-specific attributes used by the ASP.NET page parser and compiler and can be included only in .ascx files (user controls).


Indicates that a page or user control implements a specified .NET Framework interface declaratively


Imports a namespace into a page or user control explicitly.


Identifies a page as a master page and defines attributes used by the ASP.NET page parser and compiler and can be included only in .master files.


Defines the class or virtual path used to type the Master property of a page


Controls the output caching policies of a page or user control declaratively


Defines page-specific attributes used by the ASP.NET page parser and compiler and can be included only in .aspx files.


Creates a strongly typed reference to the source page from the target of a cross-page posting


Links a page, user control, or COM control to the current page or user control declaratively


Associates aliases with namespaces and classes, which allow user controls and custom server controls to be rendered when included in a requested page or user control


@ Assembly Directive

  • Links an assembly to an ASP.NET application file (such as a Web page, a user control, a master page, or a Global.asax file) during compilation, making all the assembly's classes and interfaces available for use.



The syntax of Assembly directive is.

<%@ Assembly Name="assemblyname" %>

<%@ Assembly Src="pathname" %>

  • Assemblies located in the \bin subdirectory under the application's virtual root are automatically linked to the application and do not need to be included in an Assembly directive. There are two permissible attributes, listed in the table below.





A string that represents the name of the assembly to link

(The name of the assembly to link to the application or page. Does not include a filename extension. Assemblies usually have a dll extension.)


The path to a source files to dynamically compile and link against.


Note: You must include either a Name or a Src attribute in an @ Assembly directive, but you cannot include both within the same directive. If you need to use both of these attributes, you must include multiple @ Assembly  directives in the file.

@ Control Directive

  • It specifies the attribute and values that are associated with WebUserControl (.ascx).

  • It is used to bind as ASP.NET user control.

  • It defines the properties to be inherited by the user control.

  • When the page is parsed and compiled then these values are assigned then assigned to the user control.

  • Some of the attributes of the master page directive is :- Code File, Debug, Language, Inherits, EnableView State, Src, ClassName, Description, CompilerOptions


<%@ Control Language="C#" ClassName="WebUserControl" %>.

  • The following table shows the list of attributes of Control directive.





Indicates whether the control's events are autowired true if event autowiring is enabled; otherwise, false. The default is true. 


A string that specifies the class name for the control that will be dynamically compiled when the control is requested


Specifies the name of the compiled file that contains the class associated with the control.This attribute is not used at run time.


Specifies a path to the referenced code-behind file for the control.This attribute is used together with the Inherits attribute to associate a code-behind source file with a user control. The attribute is valid only for compiled controls.


Specifies a path to a base class for a control and its associated code-behind class


Sets whether the control should be compiled, using a string that specifies one of several enumerated options. The default value is Always, so .aspx controls are compiled by default. 


A string containing compiler options used to compile the control. In C# and Visual Basic, this is a sequence of compiler command-line switches.


Indicates whether the control should be compiled with debug symbols. true if the control should be compiled with debug symbols; otherwise, false. Because this setting affects performance, you should only set the attribute to true during development.


Provides a text description of the control. This value is ignored by the ASP.NET parser


Indicates whether themes are used on the control. true if themes are used; otherwise, false. The default is true.


Indicates whether view state is maintained across control requests. true if view state is maintained; otherwise, false. The default is true.


If language is VB, tells compiler to use Option Explicit mode. Default is false.


Defines a code-behind class for the control to inherit

This can be any class derived from the UserControl class


Specifies the language used when compiling all inline rendering (<% %> and <%= %>) and code declaration blocks within the control. 


Determines whether the runtime should generate line pragmas in the source code These are compiler options that are often used by debugging tools to mark specific locations in a source file.true if line pragmas should be generated; otherwise, false.


Specifies a path to a source file containing code that is linked to the control


Indicates that the control should be compiled using the Visual Basic Option Strict mode. true ifOption Strict is enabled; otherwise, false. The default is false.


Specifies the name of a schema that validates content on the control. This serves only a descriptive purpose; no actual validation is performed, and the attribute is ignored by the parser.


Indicates the compiler warning level at which you want the compiler to treat warnings as errors, thus aborting compilation of the control. Possible warning levels are 0 through 4.


Pr.Pg border                                              Next Pg