Try our conversational search powered by Generative AI!

How to refresh IFrameComponent after page is published


I have an iframecomponent whose values depend on the values of URLSegment/PageName, so when a page is published, I have to refresh the values inside the component.

This is the definition of the component:

[IFrameComponent(Url = "modules/xx/yy.aspx",
        ReloadOnContextChange = true,
        PlugInAreas = "/episerver/cms/assets",
        Categories = "cms",
        MinHeight = 400,
        MaxHeight = 650,
        SortOrder = 201,
        Title = "xx",
        Description = "xx",
        IsAvailableForUserSelection = true
public partial class YY: ContentBaseWebForm 


Earlier (until 7.5 version, this code worked):

            var editPanel = HttpContext.Current.Handler as EditPanel;
            if (editPanel != null)
                editPanel.SavedChanges += new EventHandler(editPanel_SavedChanges);

Now, EditPanel doesn't seem to exist and I am not sure how to do this differently.

Dec 10, 2013 15:16

Any ideas?

Dec 20, 2013 13:43

Please try this:

var contentEvents = ServiceLocator.Current.GetInstance<IContentEvents>();
contentEvents.PublishedContent += contentEvents_PublishedContent;


Hope that help!

Ha Bui

Edited, Dec 26, 2013 10:54

Hi, habu,

I don't think this helps me, I don't have a problem with C# code, I am not sure how to execute the code after a page is published. I wanted to avoid using javascript polling.

I imagined there should be some way to subscribe to some dojo event that is raised after a page is published.

Jan 13, 2014 10:13

Hi Marija!

We don't have a really nice way to do this at the moment. Since our widgets bind to the data on the client and this is updated we really don't have this need ourselves. I found that we do publish an event when publishing to handle potentially changes in sort order and it should be possible to listen to this event using the pub/sub system. I consider this somewhat a hack/temporary solution that can be used until we have a more proper way to do this:

//(topic = "dojo/topic")

topic.subscribe("/epi/cms/contentdata/childrenchanged", function (contentReference) {


Edited, Jan 13, 2014 11:24

Hey, Linus, thx a bunch for the answer, it seems like I am on the right track.

There is just one tiny glitch - this even is called when page is saved, not when it's published. My stuff get executed after a page is published, so I guess I need another event. I can't find it, however. Is there one?

Jan 13, 2014 15:42

Hi Marija,

As Linus said, that's a temporary way! Because Publish command will publish this event when content is published. So you can listen and get content right back by version agnostic id and check its status!

I found another way (at the server side):

1. After content published the context will be changed!

2. After context changed IFrameContextComponent.js will be reload (because you set ReloadOnContextChange = true)

3. It will query back to server with url like: http://yoursite/<url to your modules>/<your control>?uri=epi.cms.contentdata:///6&id=6

I don't think we can not handle by this way!

Hope that help!

// Ha Bui

Edited, Jan 13, 2014 16:28

Hi, habu,

Thx for the answer, however, this still doesn't work.

I already have ReloadOnContextChange = true, however, IFrameContextComponent.js does not refresh my plugin. 

Edited, Jan 13, 2014 16:53

Ah, I know why, when IFrameComponent.js call to IFrame.js > load method, the method will be resolved immediately because the url is not dfference with current and we don't force reload! :(

The final way you can try is customize wiget type inherited from IFrameComponent.js and override method below:

_constructQuery: function (context)


You can override like this:

_constructQuery: function (context) {
            return {
                uri: context.uri,
                id: || "",
                clientTicks: new Date().getMilliseconds()


Just a trivival way! I'll try find out a better way!

// Ha Bui

Edited, Jan 13, 2014 17:35

I do not having a direct solution (other than listening to the event mentioned previosly) but have noted this for future improvements.

Jan 17, 2014 13:55
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.