Dec 5, 2008

A safe master page

The master page use contentplaceholder as reserve space for the client to fill in it with customized content. If you develop a master page with a placeholder, it is optional for the content page to fill in the placeholder. If the client fill in a placeholder, which is not defined in master page, this will throw an exception. So to be safe, the master page, should have all the placeholder that all client pages use. MSDN has an article about How to create a minimal master page. But is is not necessary, if you develop a master page which will never be applied to the content page out of the box, and it is only used by your customized content page. In this case , you have full control of what place holder be put in the master page.

But you can control the whether the client page's content is visible or not in the master page. There is the trick.