Nested Master Pages and Design Time
Does that error annoy you when trying to use this cool feature of ASP.NET 2.0?
Yeah, me too. I finally (got bored/had time/was unlazy enough) to Google and try to find a resolution to this and, of course, Scott Guthrie had the answer. Now that I look at it, I can’t believe I spent time in the past just accepting that Source View was the only option.
The tip/trick works by adding a base-page class to your project or solution that defines a new property called “RuntimeMasterPageFile” of type string. The base-class then overrides the page’s “OnPreInit” method and uses this property to set the Page object’s MasterPageFile at runtime:
Thanks Scott for sharing!