The ObjectScope has already been disposed and it's manag

Posted by Community Admin on 04-Aug-2018 14:06

The ObjectScope has already been disposed and it's managed persistent objects can no longer be accessed

All Replies

Posted by Community Admin on 06-Mar-2013 00:00

When I bind 'SiteMapNavigationTreeView', I got following error ;

'The ObjectScope has already been disposed and it's managed persistent objects can no longer be accessed. The ObjectScope should be disposed at the end of the life cycle of your business logic instance. This can also be done in the Dispose of your ASP page or MVC controller.
Object name: 'OpenAccessRuntime.EnlistableObjectScope'

It throws exception, In this code line : 'siteMapControl_verticaltree.DataSource'

aspx

<sf:ConditionalTemplateContainer ID="conditionalTemplate" runat="server">
    <Templates>
        <sf:ConditionalTemplate ID="ConditionalTemplate8" Left="NavigationMode" Operator="Equal"
            Right="VerticalTree" runat="server">
            <navcontrols:SiteMapNavigationTreeView runat="server" ID="siteMapControl_verticaltree"
                Skin="Sitefinity">
            </navcontrols:SiteMapNavigationTreeView>
        </sf:ConditionalTemplate>
    </Templates>
</sf:ConditionalTemplateContainer>

cs

 Guid currentNodeId = SitefinitySiteMap.GetCurrentNode().Id;
        PageNode currentNode = PageManager.GetManager().GetPageNode(currentNodeId);        

        using (var app = App.WorkWith())
       
            siteMapControl_verticaltree.DataSource = app.Pages().LocatedIn(Telerik.Sitefinity.Fluent.Pages.PageLocation.Frontend).ThatArePublished().Where(p => p.ParentId == currentNode.Id && p.ShowInNavigation == true).OrderBy(p => p.Ordinal).Get();
            siteMapControl_verticaltree.DataBind();
       

Can somebody show me how to solve this problem?

This thread is closed