Tips for Nested Master Pages and VS 2005 Design-Time
page 2 of 3
by Scott Guthrie
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 18204/ 44
Article Contents:

Update

Brian also pointed out to me that you can leave the MasterPageFile attribute value as "" and the designer will then automatically render a test master page that just lists all of the content-placeholder controls in editable regions.  This might allow you to avoid having to define a test master page for your site.

Here is a simple sample that shows all this working (you can switch the default.aspx page to use either the submaster.master or submaster2.master page that is based on mainmaster.master).

Hope this helps and is useful,

Scott


View Entire Article

User Comments

Title: That is a great tip!   
Name: Kim Berry
Date: 2008-01-04 9:10:31 AM
Comment:
I was about to give up on nested masterpages and use controls or something. But Daniel D' Armas tip worked - eg in default.aspx i put:

MasterPageFile="~/MasterPageStaticInner1.master "

and i can view it in design mode, and it functions at run time.
Title: RuntimeMasterPageFile compiler warning   
Name: pam
Date: 2007-11-02 6:50:37 PM
Comment:
This code works great but is there a way to stop the compiler warning "Validation: Attribute 'RuntimeMasterPageFile' is not a valid attribute of element 'Page'?
Title: Helpful Trick   
Name: Daniel D' Armas
Date: 2007-02-09 10:31:02 AM
Comment:
I've seen that clearing the content of the MasterPageFile attribute of the @Page let you view the page in design mode with no styles, but stills being awful for us (Developers) 'cause we have to set it again when we want to run the application, so trying to fix this i found something that could help, if you don't remove the content of the MasterPageFile Attribute but you only add a blank space the Runtime will render exactly like if you removed the content with the exception that you haven't to remove this space when your run your application.

Example: MasterPageFile="Admin.master "

So add a blank space and you're done!.
Title: aay   
Name: jay
Date: 2006-08-19 2:39:10 AM
Comment:
RuntimeMasterPageFile="SubMaster.master"

error

please update your code

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2019 ASPAlliance.com  |  Page Processed at 2019-09-20 9:03:50 PM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search