Any valid reason to Nest Master Pages in ASP.Net rather than Inherit?
- by James P. Wright
Currently in a debate at work and I cannot fathom why someone would intentionally avoid Inheritance with Master Pages.
For reference here is the project setup:
BaseProject
MainMasterPage
SomeEvent
SiteProject
SiteMasterPage
nested MainMasterPage
OtherSiteProject
MainMasterPage (from BaseProject)
The debate came up because some code in BaseProject needs to know about "SomeEvent". With the setup above, the code in BaseProject needs to call this.Master.Master. That same code in BaseProject also applies to OtherSiteProject which is just accessed as this.Master.
SiteMasterPage has no code differences, only HTML differences.
If SiteMasterPage Inherits MainMasterPage rather than Nests it, then all code is valid as this.Master.
Can anyone think of a reason why to use a Nested Master Page here instead of an Inherited one?