asp.net.ph

Skip Navigation Links

@ MasterType

ASP.NET Syntax   ASP.NET Page Syntax   Page Directives


.NET Framework version 2.0

Provides a way to create a strongly typed reference to the ASP.NET master page when the master page is accessed from the Master property.

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

Attributes


Term Definition
TypeName Specifies the type name for the master page.
VirtualPath Specifies the path to the file that generates the strong type.

Remarks

The @ MasterType directive is used to set the strong type for the master page, as accessed through the Page.Master property.

NOTE: if VirtualPath is not defined, the type must exist in one of the currently linked assemblies, such as App_Bin or App_Code.

If both attributes, TypeName and VirtualPath, are defined, the @ MasterType directive will fail.

Syntax Example

The following code example demonstrates how to set the virtual path to an ASP.NET master page.

<%@ MasterType VirtualPath = "~/masters/SourcePage.master”" %>
See Also

ASP.NET Master Pages



© 2025 Reynald Nuñez and asp.net.ph. All rights reserved.

If you have any question, comment or suggestion
about this site, please send us a note