2
votes

I'm using Sitecore 8. I have custom ModalDialog, it is getting triggered by a button in the Ribbon (Content Editor).

On the Dialog backend, I'm removing the scope Item. So OnOk I want Refresh the Parent and load Parent item on dialog close.

I have the following code but it is not working,

protected override void OnOK(object sender, EventArgs args)
    {

        //ScopeItem - Current Item in the Content Tree
        //db - Database
        RemoveItem(ScopeItem, db);


        //ScopeItemParent- Current Item's Parent Item
        Context.ClientPage.SendMessage(this, string.Format("item:updated(id={0})", ScopeItemParent.ID));
        Context.ClientPage.SendMessage(this, string.Format("item:refreshchildren(id={0})", ScopeItemParent.ID));
        Context.ClientPage.ClientResponse.Timer(string.Format("item:load(id={0})", ScopeItemParent.ID), 100);

        base.OnOK(sender, args);
    }

Thanks for your help.

1

1 Answers

1
votes

The normal Delete command does exactly that. It simply calls Sitecore.Shell.Framework.Items.Delete(), which then runs the uiDeleteItems client pipeline. You should be able to do the same by doing something like this:

protected override void OnOK(object sender, EventArgs args)
{
    //ScopeItem - Current Item in the Content Tree
    Sitecore.Shell.Framework.Items.Delete(new[] { ScopeItem });

    base.OnOK(sender, args);
}