Hide menu Last updated: Sep 21 2015

This topic describes how to create components for web forms using the IFrameComponent attribute to embed web forms into the new user interface without the need to write client code.

Using the IFrameComponent attribute

To create an IFrameComponent, add the IFrameComponent attribute to the class as follows:

public class MyWebForm : SystemPageBase

The IFrameComponent attribute is extendable so that you can add additional functionality if needed.

The IFrameComponent has some required and optional parameters as follows:

Url (required) The URL to the source. This is the original URL that is loaded into the iFrame when it is initialized.
ReloadOnContextChange (optional) Default value is true. When set to true, the iFrame is reloaded when the context is changed. The component will add context-specific query parameters to the SourceUrl attribute (see above). The parameters added are uri and id.
KeepUrlOnContextChange (optional) Default value is false. When set to true, the component keeps the currently loaded URL when reloading the iFrame, otherwise it reloads the original URL every time the context is changed.
MinHeight (optional) Default value is 100. The minimum height of the iFrame.
MaxHeight (optional) Default value is 500. The maximum height of the iFrame.

Context awareness

The component keeps track of context changes for times that you need to know when the user has changed the page in the page tree. The component reloads the iFrame (when ReloadOnContextChange is set to true) and sets query parameters with information about the context. The following parameters are set:

uri The key uniquely identifying the entity in context, for example, epi.cms.pagedata:///3_177.
id The id of the page in the context to be used by the PageBase class to load the current page.

Changing the IFrameComponent properties in client code

Sometimes the requirements of a web form change after initialization (such as a reload on context changes). The following example shows how the properties of the IFrameComponent are changed from within the iFrame:

var reloadOnContextChange = function (value) {
    // Check that there is a parent available and it got dijit loaded
    if(parent && parent.dijit) {
        // Get all iFrames in the document
        var iframes = parent.document.getElementsByTagName(""IFRAME"");
        for(var i = 0; i < iframes.length; i++) {
            if(iframes[i].contentWindow === window) {
                // Get the dijit widget
                var component = window.parent.dijit.byId(iframes[i].id);
                if(component) {
                    component.reloadOnContextChange = value;