Home > .net 2.0, c# > Nested Master Pages and Design Time

Nested Master Pages and Design Time

January 29, 2007

NestedMasterPages

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:

ScottGu’s Blog : Tips for Nested Master Pages and VS 2005 Design-Time.

Thanks Scott for sharing!

Categories: .net 2.0, c#
  1. No comments yet.
  1. July 29, 2007 at 11:14 am
Comments are closed.
%d bloggers like this: