Search code examples
telerikdotnetnukedotnetnuke-9

Prevent Page Reload on Module Selection DNN 9


When I click on a module inside of the module selection dialog, DNN refreshes the page (before the hovering, draggable element appears on the page). This only happens using our skin (https://github.com/2sic/dnn-theme-bootstrap3-instant).

DNN is looking for the element #dnn_ContentPane_SyncPanel (which seems to be an ajax wrapper) with Teleriks findComponent method. Because the element can't be found, DNN performs a page reload.

Our skins content pane:

<div id="ContentPane" runat="server" containertype="G" containername="Invisible Container" containersrc="default.ascx"></div>

The DNN code, that triggers the reload (last function call):

refreshPane: function (paneName, args, callback, callOnReload) {
    var paneId;
    if (!paneName) {
        paneId = this.getModuleManager().getPane().attr('id');
    } else {
        paneId = this.getPaneById(paneName).attr('id');
    }

    var pane = $('#' + paneId);
    var parentPane = pane.data('parentpane');
    if (parentPane) {
        this.refreshPane(parentPane, args, callback);
        return;
    }
    //set module manager to current refresh pane.
    this._moduleManager = pane.data('dnnModuleManager');
    var ajaxPanel = $find(paneId + "_SyncPanel");
    if (ajaxPanel) {
        //remove action menus from DOM bbefore fresh pane.
        var handler = this;
        pane.find('div.DnnModule').each(function () {
            var moduleId = handler._moduleManager._findModuleId($(this));
            $('#moduleActions-' + moduleId).remove();
        });

        Sys.WebForms.PageRequestManager.getInstance().add_endRequest(this._refreshCompleteHandler);
        this._refreshPaneId = paneId;
        this._refreshCallback = callback;
        ajaxPanel.ajaxRequest(args);
    } else {
        //save the args into cookie, after page reload then catch the cookie
        //and float the module for drag
        if (args && !this._noFloat) {
            this._setCookie('CEM_CallbackData', args);
        }

        if (callOnReload && typeof callback == "function") {
            callback.call($('#' + paneId), [true]);
        }

        location.reload();
    }
}

Solution

  • After some time, we found out what the issue was. Our skin was using the <%=SkinPath%> syntax instead of <%#SkinPath%>, which caused DNN to force a reload. This probably has to do with the lifecycle of the document.