Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Debasish Gracias 8 posts 78 karma points
    4 days ago
    Debasish Gracias
    0

    Reload node programmatically after content move

    Hi Everybody

    Required some help. I am moving an item using the 'contentService' from one place to another. The item does move to the destination node, however it is still shown in the source node. I need to manually reload the browser for the item from source node to disappear. Is there any way to reload a node? Here is my code:

    private void ContentService_Saved(IContentService sender, SaveEventArgs<IContent> e)
            {
                foreach (var content in e.SavedEntities)
                {
                    if (content.IsNewEntity())
                    {
                        CreatePageItemsFolder(content, sender);
                    }
                    if (content.ContentType.Alias.Equals(CasePage.ModelTypeAlias))
                    {
                        if (content.HasProperty("done") && content.GetValue<bool>("done"))
                        {
                            var contentService = ApplicationContext.Current.Services.ContentService;
                            var target = content.Parent().Parent().Children().Where(x => x.ContentType.Alias == CaseListingPage.ModelTypeAlias && x.Template.Alias == "DoneCasesPage").First();
                            if (content.ParentId!= target.Id)
                            {
                                contentService.Move(content, target.Id);
                            }
                        }
                    }
                }
            } 
    
Please Sign in or register to post replies

Write your reply to:

Draft