Refresh Sitecore after changing icon of Item

丶灬走出姿态 提交于 2019-12-11 13:04:13

问题


I hooked up an extra eventhandler to the Sitecore onItemSaved actions to change the icon of an item in Sitecore. The icon gets changed, but you have to refresh the Sitecore content tree to see that it has changed. Is it possible to programatically make sure the changed icon gets visible to the user instantly in the content tree?

I used:

item.Field["__icon"].Value = "someicon.pgn"

with a Editing.BegintEdit() and a EventDisabler around it.

When you change the Icon of an item in Sitecore itself, the icon gets visible instantly, this is what I would like to see aswell.

Any suggestions?

Thanks!


回答1:


To refresh the content tree from the code use:

//TODO: set to the appropriate item 
String refresh = String.Format("item:refreshchildren(id={0})", currentItem.Parent.ID);
Sitecore.Context.ClientPage.SendMessage(this, refresh);



回答2:


Remove the EventDisabler, that's likely the issue... It also disables client events...



来源:https://stackoverflow.com/questions/7362464/refresh-sitecore-after-changing-icon-of-item

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!