More in this section

Forums / General Discussions / Page Creation

Page Creation

5 posts, 1 answered
  1. Jaime Weise
    Jaime Weise avatar
    120 posts
    Registered:
    02 Nov 2008
    01 Nov 2010
    Link to this post
    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();

  2. Radoslav Georgiev
    Radoslav Georgiev avatar
    3370 posts
    Registered:
    01 Feb 2016
    01 Nov 2010
    Link to this post
    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
    Answered
  3. Jaime Weise
    Jaime Weise avatar
    120 posts
    Registered:
    02 Nov 2008
    02 Nov 2010
    Link to this post
    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.

  4. Phil
    Phil avatar
    89 posts
    Registered:
    19 Oct 2010
    23 Nov 2010
    Link to this post
    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
  5. Phil
    Phil avatar
    89 posts
    Registered:
    19 Oct 2010
    24 Nov 2010
    Link to this post
    Radoslav solved this problem in another post here.
     
     
5 posts, 1 answered