I have created a sharepoint dialog using the HostWebDialog="true" option in my custom action. The issue is that if the data in the dialog box is larger than can be displayed there, I cannot scroll to this data without highlighting text and then dragging my mouse down.

I was able to add a scrollbar to my page that is displayed in the dialog itself, but this scrollbar is maxed out and acts as if there is no where to scroll. The scroll bar doesnt seem to be on the dialog itself.

Is there a way to force a scroll bar onto the dialog directly, and not in the body of my page I am displaying in the dialog?


I solved this by grabbing the height of the iframe and then setting my contents height to the iframes height

$(document).ready(function () {
    var iframeHeight = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
    $('#contentdiv').css('height', iframeHeight);

The height of the iframe needs to be explicitly set in the custom action of your elements.xml using the HostWebDialogHeight parameter.

If you do not set the height using that parameter, sharepoint appears to wait for the $(document).ready event itself to dynamically resize the iframe based on the size of the browser window and the content loaded, and you will end up getting the wrong value for iframeHeight

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.