We have created a custom EditPanel plugin used for a certain type of page. This contains functionality to clean up connections before deleting itself. The cleanup and delete part works fine, but when I am done I would like to redirect to the parent page of the deleted page, while in edit mode. Otherwise I get an exception - page does not exist, since I just deleted it.
Is there a nice way to access the page tree and set selectedItem or similar?
Thanks in advance :-)
Could you get the PageData of the parent before deleting and just redirect using the ID of the parent for example www.yoursite.com/cmspath/edit/default.aspx?id=parentid
Thanks for your suggestion and this is actually what I am doing right now. The problem is that the editpage is in a IFrame so only that content is redirected. The menu is still showing the former (non existing page) as selected, which is a bit confusing. I guess I could place som script in the parent page to refresh the window outside the iframe, but I was hoping for a more Episerver way of doing this and less of a "ful-hack", as this would be called in sweden.
If no other solution comes up I will create new page, Redirector.aspx, that refreshes the outer frame with some script. If someone has done this before (refresh the page tree and show the correct selected page, I would really like to re-use your scripts...
window.top.location.href = 'Default.aspx?id=<%=ParentPageId%>'
This worked fine for us as it was executed on a button click, not sure what you would use as trigger here though.
Thanks for your input, Paul,
I have created a page to redirect to, so that I can show a nice message. From this page I can run this script, will try this after the weekend.