November Happy Hour will be moved to Thursday December 5th.

Can't save Page Property pointing to an XML Page Provider Page

Vote:
 

I have a page with a page property that I want to point to a page generated from my XML Page Provider. The page appears correctly in the tree, I can select it och click OK, but when I try to save the page I get this error:

Server Error in '/' Application.
--------------------------------------------------------------------------------
The INSERT statement conflicted with the FOREIGN KEY constraint "FK_tblWorkProperty_tblPage". The conflict occurred in database "vinnova_epi_cms", table "dbo.tblPage", column 'pkID'. 
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
Exception Details: System.Data.SqlClient.SqlException: The INSERT statement conflicted with the FOREIGN KEY constraint "FK_tblWorkProperty_tblPage". The conflict occurred in database "vinnova_epi_cms", table "dbo.tblPage", column 'pkID'.
Source Error: 
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  
Stack Trace: 
[SqlException (0x80131904): The INSERT statement conflicted with the FOREIGN KEY constraint "FK_tblWorkProperty_tblPage". The conflict occurred in database "vinnova_epi_cms", table "dbo.tblPage", column 'pkID'.]
   System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +1950890
   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4846875
   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194
   System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2392
   System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +204
   System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +954
   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +162
   System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +175
   System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +137
   EPiServer.DataAccess.AbstractCommand.ExecuteNonQuery() +15
   EPiServer.DataAccess.PageSaveDB.SavePageVersionProperty() +547
   EPiServer.DataAccess.PageSaveDB.CreateAndSave(SaveAction action, String currentUser) +127
   EPiServer.DataAccess.<>c__DisplayClass1f.<Save>b__1e() +203
   EPiServer.DataAccess.<>c__DisplayClass7.<Execute>b__6() +57
   EPiServer.DataAccess.DatabaseFactory.Execute(Action`1 method) +290
   EPiServer.DataAccess.DataAccessBase.Execute(Action action) +92
   EPiServer.DataAccess.PageSaveDB.Save(PageData page, SaveAction action, String currentUser) +111
   EPiServer.LocalPageProvider.Save(PageData page, SaveAction action) +53
   EPiServer.DataFactory.Save(PageData page, SaveAction action, AccessLevel access) +425
   EPiServer.DataFactory.Save(PageData page, SaveAction action) +183
   EPiServer.Web.PageExtensions.SaveCurrentPage.SavePage() +94
   EPiServer.PageBase.SavePage() +157
   EPiServer.UI.Edit.EditPanel.SavePage() +153
   EPiServer.UI.Edit.EditPageButtonControl.Save(SaveAction saveAction, Boolean goToViewPage) +50
   EPiServer.UI.Edit.EditPageButtonControl.Publish_Click(Object sender, EventArgs e) +20
   EPiServer.UI.WebControls.ToolButton.OnClick(EventArgs e) +107
   EPiServer.UI.WebControls.ToolButton.RaisePostBackEvent(String eventArgument) +135
   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36
   System.Web.UI.Page.ProcessRequestMain(
 

Server Error in '/' Application.--------------------------------------------------------------------------------
The INSERT statement conflicted with the FOREIGN KEY constraint "FK_tblWorkProperty_tblPage". The conflict occurred in database "mydatabasename", table "dbo.tblPage", column 'pkID'. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 
Exception Details: System.Data.SqlClient.SqlException: The INSERT statement conflicted with the FOREIGN KEY constraint "FK_tblWorkProperty_tblPage". The conflict occurred in database "mydatabasename", table "dbo.tblPage", column 'pkID'.
Source Error: 
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  
Stack Trace: 

[SqlException (0x80131904): The INSERT statement conflicted with the FOREIGN KEY constraint "FK_tblWorkProperty_tblPage". The conflict occurred in database "vinnova_epi_cms", table "dbo.tblPage", column 'pkID'.]   System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +1950890   System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +4846875   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +194   System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +2392   System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +204   System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +954   System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +162   System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +175   System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +137   EPiServer.DataAccess.AbstractCommand.ExecuteNonQuery() +15   EPiServer.DataAccess.PageSaveDB.SavePageVersionProperty() +547   EPiServer.DataAccess.PageSaveDB.CreateAndSave(SaveAction action, String currentUser) +127   EPiServer.DataAccess.<>c__DisplayClass1f.<Save>b__1e() +203   EPiServer.DataAccess.<>c__DisplayClass7.<Execute>b__6() +57   EPiServer.DataAccess.DatabaseFactory.Execute(Action`1 method) +290   EPiServer.DataAccess.DataAccessBase.Execute(Action action) +92   EPiServer.DataAccess.PageSaveDB.Save(PageData page, SaveAction action, String currentUser) +111   EPiServer.LocalPageProvider.Save(PageData page, SaveAction action) +53   EPiServer.DataFactory.Save(PageData page, SaveAction action, AccessLevel access) +425   EPiServer.DataFactory.Save(PageData page, SaveAction action) +183   EPiServer.Web.PageExtensions.SaveCurrentPage.SavePage() +94   EPiServer.PageBase.SavePage() +157   EPiServer.UI.Edit.EditPanel.SavePage() +153   EPiServer.UI.Edit.EditPageButtonControl.Save(SaveAction saveAction, Boolean goToViewPage) +50   EPiServer.UI.Edit.EditPageButtonControl.Publish_Click(Object sender, EventArgs e) +20   EPiServer.UI.WebControls.ToolButton.OnClick(EventArgs e) +107   EPiServer.UI.WebControls.ToolButton.RaisePostBackEvent(String eventArgument) +135   System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13   System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +36   System.Web.UI.Page.ProcessRequestMain( 

 

Am I not supposed to be able to do this?

 

Jakob

#38728
Apr 20, 2010 15:17
Vote:
 

In CMS5 a property of type PageReference is stored in database as an integer. A consequence of this is that it is not possible to store a reference to a page served by another page provider.

This has been fixed in CMS6. In next minor release of CMS6 (probably called SP1) we have also fixed so it is possible to have shortcut/fetch data to work against pages from other page providers.

To get it to work in CMS5 you cannot use the built in PropertyPageReference (int based) to store the reference. You need to build your own custom property to store the reference.

#38739
Apr 20, 2010 16:07
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.