The PreviousPageType directive isn't the only one that provides strongly-typed access to controls. If you have public properties defined in a Master Page that you'd like to access in a strongly-typed manner you can add the MasterType directive into a page as shown next (note that the MasterType directive also allows a TypeName to be defined as with the PreviousPageType directive):
<%@ MasterType VirtualPath="MasterPage.master" %>
You can then access properties in the target master page from a content page by writing code like the following:
this.Master.HeaderText = "Label updated using MasterType directive with VirtualPath attribute.";
0 comments:
Post a Comment