I have made a publishing page layout that has a WebPartZone and a MediaWebPart in the ZoneTemplate. Example below.
<WebPartPages:WebPartZone runat="server" Title="Fokusøki Media" ID="WebPartZone1" AllowLayoutChange="true" AllowPersonalization="false">
<ZoneTemplate>
<PublishingWebControls:MediaWebPart ID="mediaWebPart1" AutoPlay="true" AllowEdit="true" AllowClose="true" Title="MediaWebPart" runat="server" />
</ZoneTemplate>
</WebPartPages:WebPartZone>
The WebPart show just fine on the page, and works like supposed. But when i click "Save and Close" or "Publish" on the ribbon, I get the following error message.
The operation could not be completed because the Web Part is not on this page. Stack Trace:
[WebPartPageUserException: The operation could not be completed because the Web Part is not on this page.]
Microsoft.SharePoint.WebPartPages.SPWebPartManager.ThrowIfNotOnPage(WebPart webPart) +27111847
Microsoft.SharePoint.WebPartPages.SPWebPartManager.GetStorageKey(WebPart webPart) +30
Microsoft.SharePoint.Publishing.WebControls.MediaWebPart.UpdateWebPartProperties() +380
Microsoft.SharePoint.Publishing.WebControls.MediaWebPart.OnLoad(EventArgs e) +49
System.Web.UI.Control.LoadRecursive() +66
System.Web.UI.Control.LoadRecursive() +191
System.Web.UI.Control.LoadRecursive() +191
System.Web.UI.Control.LoadRecursive() +191
System.Web.UI.Control.LoadRecursive() +191
System.Web.UI.Control.LoadRecursive() +191
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2428