Why won't Visual Studio let me edit a page derived from a master in design mode?

ASP.Net 2.0 added a useful new feature called Master Pages. These provide a template (or multiple templates) for a web site, with the actual content being provided via ContentPlaceHolder controls on the master page. The web site pages simply fill the ContentPlaceHolder controls, and site layout is the responsibility of the master page. So far, so good.

Unfortunately, there's a fly in the ointment. If you use an ASP table element (as opposed to a raw HTML table) to do your master page layout, with embedded ContentPlaceHolders, then the Visual Studio 2005 designer can't cope and will refuse to let you edit a slave page derived from the master (it draws a "gray gauze" over the window). If you look in the error window you see the message "Could not match XXXXX' with any ContentPlaceHolder" where XXXXX is the ID of the ContentPlaceHolder on the master page.

Replacing the ASP table with an HTML table on the master page will solve the problem, but then you walk into a new problem - the HTML table, being a passive component, cannot do the URL rewriting necessary to fixup any URLs you include on the master page as the slave page is rendered. Typically this means any background graphics you have on the master page render correctly for one or more slave pages, but not for others. Nasty.


Sidestep the problem entirely - forget using tables for layout, join the 21st century and use DIVs to layout your master page.