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.
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);
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With