Page Layouts, Solutions and SharePoint Designer (Updated)

If you are deploying custom page layouts using a feature, DO NOT OPEN THEM IN SHAREPOINT DESIGNER! Not even once. Not just to “take a look”. Not for giggles.

Why? Because once you open that page layout in SharePoint Designer, it gets un-ghosted. This does two things. First, it means that you have to make changes in SharePoint Designer. The .aspx file in the feature directory is no longer used when rendering pages based on that page layout. Second, if you’ve attached a code-behind to the page, you’ll get a error indicating that type is not registered as safe. This occurs because SharePoint uses a type-safe parser on all un-ghosted content.

If you’ve come accross this post because you already did open the page layout in SPD, have no fear. To remedy your error, simply go to Site Actions…Site Settings…Reset to Site Definition. Once you do that, re-deploy your feature containing the page layout. Now, your page layout is ghosted.

Update: Well, I ran into an issue where “Reset to Site Definition” just didn’t work. So, I tried the stsadm command here (with -force): http://stsadm.blogspot.com/2007/09/re-ghosting-pages.html and now we’re back to un-ghosted. Very frustrating.

One Thought on “Page Layouts, Solutions and SharePoint Designer (Updated)

  1. Pingback: Links (1/24/2010) « Steve Pietrek-Everything SharePoint/Silverlight

Post Navigation

Switch to our mobile site