What are page directives?
The first line of an ASP.NET page is the page directive; you will find it on all ASP.NET pages. These directives are instructions for the page. It begins with the @Page directive and continues with the various attributes available to this directive.It’s unreasonable to expect a candidate to know all of these attributes, but a few popular ones include the following.
- AutoEventWireup: Indicates whether page events are autowired.
- CodeBehind: The name of the compiled class associated with the page.
- Debug: Indicates whether the page is compiled in debug mode (includes debug symbols).
- EnableTheming: Indicates whether themes are used on the page.
- EnableViewState: Indicates whether view state is maintained across pages.
- ErrorPage: Specifies a target URL to be used when unhandled exceptions occur.
- Language: Indicates the language used when compiling inline code on the page.
- Trace: Signals whether tracing is enabled on the page.
What is a master page?
A master page is a template for one or more Web Forms. The master page defines how the page will be laid out when presented to the user, with placeholders for content. The MasterPageFile Page Directive in a content page’s header is one way to assign a master page. The content pages rely solely on content and leave layout to the master page. ASP.NET merges the content with the master page layout when the content page is requested by a user.What is the code behind feature of ASP.NET?
The code behind feature divides ASP.NET page files into two files where one defines the user interface (.aspx), while the other contains all of the logic or code (.aspx.cs for C# and .aspx.vb for VB.NET). These two files are glued together with page directives like the following line, which ties the page to the specific code behind class.<%@ Page language="c#" Codebehind="UICode.cs" Inherits="Library.UICode" %>
No comments:
Post a Comment