+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / System.InvalidOperationException: The item belongs to a different provider?

System.InvalidOperationException: The item belongs to a different provider?

2 posts, 0 answered
  1. bemara57
    bemara57 avatar
    135 posts
    Registered:
    27 Mar 2008
    25 Mar 2010
    Link to this post
    I am running into a problem where I can't save my events object even though I am pretty sure I am choosing the right provider. It's actually the same provider used to get the object in the first place. Why does this not work?

    EventsManager eventsManager = new EventsManager("Events");
    IContent content = eventsManager.Content.GetContent(itemId);
    if (content != null)
    {
        content.SetMetaData("ShortUrl", "http://test.com");
        eventsManager.SaveContent(content);
    }


    The item belongs to a different provider.

    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.InvalidOperationException: The item belongs to a different provider.

    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:

    [InvalidOperationException: The item belongs to a different provider.]
       Telerik.Cms.Engine.Data.Providers.DefaultProvider.SaveContent(IContent content, Boolean fireEvents) +458
       Telerik.Cms.Engine.ContentProviderBase.SaveContent(IContent content) +12
       Telerik.Cms.Engine.ContentManager.SaveContent(IContent content, ContentStatus status) +465
       Telerik.Cms.Engine.ContentManager.SaveContent(IContent content) +7
       Sitefinity.Events.WebControls.Admin.EventsItemEdit.SaveContent() +218
       Telerik.Cms.Engine.WebControls.Admin.ContentItemEdit`1.Button_Command(Object sender, CommandEventArgs e) +62
       System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e) +108
       System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument) +135
       System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
       System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
       System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +175
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
    


    Version Information: Microsoft .NET Framework Version:2.0.50727.4200; ASP.NET Version:2.0.50727.4016 

  2. bemara57
    bemara57 avatar
    135 posts
    Registered:
    27 Mar 2008
    25 Mar 2010
    Link to this post
    I see what the problem was... I have to use ContentManager instead.
2 posts, 0 answered