I have a control contained in an iframe on a page of my ASP.NET web application. Control changes its vertical size correspondingly to what user selects on it (some elements get in, others get out). So, I have to set the iframe size precisely to get the whole control shown and not to make gap between the iframe and the elements below it.
On self.document.body.onload on the control page, hence, I call this function:
function adjustIframeHeight() {
var iframe = window.parent.document.getElementById(window.frameElement.id);
var iframeHeight = jQuery(iframe.contentWindow.document).height();
iframe.style.height = iframeHeight + "px";
}
The problem is sometimes I get images at the bottom of the frame cutoff since the frame height is obtained before the images are loaded. I can see that, since after page refreshing I get the frame height set properly.
Is there a way to tell images to load before? I am using ASP.NET ImageButton-s and I am setting their ImageUrl property