KB's

Lost content after 4.1 upgrade

Problem:

Your content is lost after you upgraded to 4.1 or changed a page template; you have duplicate controls on the page that do not appear in edit mode.

Solution:

The reason you may be having the problem above is that after the upgrade, some of the controls on the page have become orphaned. This means they exist on the page, but are not in any of the defined placeholders. This is why they are not displayed, or are displayed on the frontend, but you cannot edit or remove them.

To fix this, you need to go through all controls on the page and place them in an existing (or default) placeholder. Then you can modify them and show/delete them through the page editor. The attached code does exactly this. It goes through orphaned controls, searches for a "Body" or "Content" placeholder, and places them there. It works on a single page, specified by the ID. 

Guid pageDataId = new Guid("6715baf7-3d9c-49fd-b80e-83607b585dcc");


You can get the ID from the database, it is located in the "sf_page_data" table, the value in the "content_id" column. You then have to run this for each page you experience problems with.

Code installation instructions:

The attached archive contains an ASPX file and a code-behind file. Extract them to the root folder of your website, make the modifications with your page IDs, then build the project and open the ASPX in a browser.