Web Tutorials

Interview Q & A

Code Examples

Utility Tools

ASP.NET Master Directive Attributes

ASP.NET Master directive defined at page-specific (.aspx file) and used by the ASP.NET page parser and compiler.

Syntax

<%@ Master attribute="value" [attribute="value"...] %>    

ASP.NET Master Directive Attributes

AttributesDescription
AutoEventWireupSpecifies the page event should autowired or not.
ClassNameSpecifies the class name that will be dynamically compiled when the page is requested.
CodeFileSpecifies the code-behind class for the current page.
CompilerOptionsSpecifies compilation options for current page.
DebugSpecifies page should be compiled with debug symbols.
DescriptionSpecifies a text description of the master page.
LanguageSpecifies language being used when compiling inline code blocks.
InheritsSpecifies the base class for the page to inherit.
SrcSpecifies the source file that contains the implementation of the base class specified with Inherits.
MasterPageFileSpecifies the master page for the current page.
EnableViewStateSpecifies whether the page view state is maintained across page requests.
EnableThemingSpecifies the page will support themes for embedded controls.
TitleSpecifies the title of the page.
ResponseEncodingSpecifies the character encoding of the page.

ASP.NET Master Directive Attributes Example C#

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="homeMasterPage.master.cs" 
Inherits="homeMasterPage" %>
<asp:Content ID="Content1" ContentPlaceHolderID="Main" Runat="Server">
    Main content.
</asp:Content>
    
<asp:Content ID="Content2" ContentPlaceHolderID="Footer" Runat="Server" >
    Footer content.
</asp:content>

ASP.NET Master Directive Attributes Example VB

<%@ Master Language="VB" AutoEventWireup="true" CodeFile="homeMasterPage.master.vb" 
Inherits="homeMasterPage" %>
<asp:Content ID="Content1" ContentPlaceHolderID="Main" Runat="Server">
    Main content.
</asp:Content>
    
<asp:Content ID="Content2" ContentPlaceHolderID="Footer" Runat="Server" >
    Footer content.
</asp:content>

RequiredFieldValidator

RegularExpressionValidator

RangValidator

CompareValidator

CustomValidator

ValidationSummary