简体   繁体   中英

Accessing Master Page and Nested Master Page Properties from Content Page

How do I access master page properties and a nested master page properties from a content page? I currently use <%@ MasterType in my content page to access properties of the nested master page, but I don't think I can simply specify another mastertype to get to the master page. Or, can I? (IIS6, .Net4, c#).

Thanks, Jon

You can access a master page by Page.Master property

Important: ( MSDN )

  1. The Master property returns the MasterPage object associated with this page. This property is read-only; however, you can set properties on the MasterPage object it returns.

  2. The Master property is valid only on pages that reference a master page in the MasterPageFile property. If you access the Master property on a page that does not reference a master page, null is returned. The contents of a master page are not available until after the PreInit event has been raised.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM