How to: Implement a custom Preview popup

The following topic illustrates how to implement a custom Preview popup.

NOTE

For a full example, see the Implement a custom Preview popup online example.

function onCloseUp() {
    previewPopup.RefreshContentUrl();
}
function onCustomCommand(commandName) {
    if (commandName == "Preview") {
        previewPopup.Show();
        window.setTimeout("setHtmlInPreviewIFrame()", 800);
    }
}
function setHtmlInPreviewIFrame() {
    var previewIFrameElement = getFrameByIFrameElement(previewPopup.GetContentIFrame());
    var previewIFrameDoc = null;
    if (previewIFrameElement.document)
        previewIFrameDoc = previewIFrameElement.document;
    else
        previewIFrameDoc = previewIFrameElement.contentDocument
        previewIFrameDoc.body.innerHTML = ASPxHtmlEditor1.GetHtml();
    }
function getFrameByIFrameElement(iframeElement) {
    var name = (new Date()).toString();
    iframeElement.contentWindow.name = name;
    var frameIndex = getFrameByWindowName(name);
    return window.frames[frameIndex];
}
function getFrameByWindowName(name) {
    var count = window.top.frames.length;
    for (var i = 0; i < count; i++) {
        if (window.top.frames[i].window.name === name)
        return i;
    }
    return -1;
}