Reputation: 355
In Sitecore, I am opening up a item in content editor using code and after user has done some changes I want to reload the content editor. I am trying to do this in Sitecore Item:Locked event handler and I am wondering whether I can raise a Sitecore event so the content editor would reload.
Upvotes: 2
Views: 1869
Reputation: 4410
First off, I think the item:locked
might not be the right event for this, as you want to do it after the user has done changes. Have you looked at the item:saved
event?
Secondly, I'm not entirely certain what it is you're trying to achieve. Is it that when any user makes a change, the instance of the content editor or someone else's machine needs to reload? I'm not sure that's possible.
Or do you want a custom piece of code to run when the user has made a change, but then the user needs to have their own instance reloaded?
If it's the latter, here's what you could try:
There's actually a couple of things you can do:
Reload item
You can use something like the following to reload the item:
string load = String.Concat( new object[] { "item:load(id=", myItem.ID, ",language=", myItem.Language, ",version=", myItem.Version, ")" });
Sitecore.Context.ClientPage.SendMessage(this, load);
Reload content editor
If you do want to load the content editor up again, you could build the URL using something like:
string.Format("/sitecore/shell/sitecore/content/Applications/Content Editor.aspx
?id={0}&fo={0}&la={1}&ver={2}", GUID of the item to be selected,
Language you want to display, version you want to display);
Then you can either redirect the user to that page (using a simple Response.Redirect
), or you can open op a new instance of the content editor (if you're in Desktop), for instance by using the Sitecore.Shell.Framework.Windows.RunApplication
method.
Upvotes: 1