Page Creation

Posted by Community Admin on 03-Aug-2018 17:34

Page Creation

All Replies

Posted by Community Admin on 01-Nov-2010 00:00

Error While Creating Pages
Object references between two different object scopes are not allowed. The object 'Telerik.Sitefinity.Pages.Model.PageNode' is already managed by 'ObjectScopeImpl 0xa48aec Telerik.OpenAccess.RT.ObjectScope' and was tried to be managed again by 'ObjectScopeImpl 0xec6ba4 Telerik.OpenAccess.RT.ObjectScope'.

Here is the Code that I am Using
...
        private PageNode CurrentPage = null;
...
// event handler
 
  
 
           PageManager pManager = new PageManager();
             
            int count;
            PagesFacade rootPageFacade = App.WorkWith().Pages().Where(pg => pg.Name == "Page1");
            CurrentPage = rootPageFacade.Get().First();
 
 
            App.WorkWith()
                   .Page()
                   .CreateNewStandardPage(parentNode)
                   .Do(p =>
                   
                       p.Name = pageName;
                       p.Title = pageName;
                       p.Description = pageName;
                       p.DateCreated = DateTime.Now; //filled in automatically, but you can control it programatically as well
                       //p.UrlName = "page1";          //filled in automatically, but you can set any url name here.
                       p.ShowInNavigation = true;
                   )
                ///.SetTemplateTo(templateGuid)
                   .SaveChanges();
            SiteMapBase.Cache.Flush();

Posted by Community Admin on 01-Nov-2010 00:00

Hello jaime,

The problem you are facing is caused because the object you are trying to edit already belongs to another transaction. Please verify that this object is not checked out by the page manager or you have some other fluent api code not closing its transaction. Proably you are not checking in a page if it has been checked out previously.

Sincerely yours,
Radoslav Georgiev
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 02-Nov-2010 00:00

Solved with your help

I found that since I was storing the PageNode items in a stack the error was being thrown. I just saved them in the stack but used the ID to retrieve the instance of the parent PageNode that I wanted to attach the new page to. This works excellent.

Posted by Community Admin on 23-Nov-2010 00:00

Jaime.

I am having the exact same problem - trying to create a child page programatically, but I dont understand your description of your solution.  Would you please post the code?

Thanks

Posted by Community Admin on 24-Nov-2010 00:00

Radoslav solved this problem in another post here.
 
 

This thread is closed