I've got an iframe in an aspx page in which I load another aspx page. Problem is that it that the height of the iframe won't adjust according to the size of the content. I have posted my code below.

Code:
        <asp:UpdatePanel ID="UpdatePanel6" runat="server">
            <ContentTemplate>
                <asp:Panel ID="pHeader6" runat="server" CssClass="cpHeader">
                    <a onclick="LoadToolEdit()"><asp:Label ID="lblText6" runat="server" Text="" /></a>
                    <a onclick="NewToolPage()"><asp:Image ID="Image3" ImageUrl="Images/050-browser-5_rz.png" ToolTip="Open New Tab" Width="25" Height="25" runat="server" 
                            style="float: right; margin-top: 0px; margin-right: 7px"/></a>
                </asp:Panel>
  
                <asp:Panel ID="pBody6" runat="server" CssClass="cpBody">
                    <iframe id="iFrameTool" src="Images/waiting-6_rz.gif" onload="AdjustFrameHeight(this)" scrolling="no" width="100%" height="220px" frameborder="0"></iframe>
                </asp:Panel>

                <ajaxToolkit:CollapsiblePanelExtender ID="CollapsiblePanelExtender6" runat="server" TargetControlID="pBody6" CollapseControlID="pHeader6" ExpandControlID="pHeader6"
                    Collapsed="true" TextLabelID="lblText6" CollapsedText="<i class='fa fa-plus'>" ExpandedText="<i class='fa fa-minus'>" CollapsedSize="0">
                </ajaxToolkit:CollapsiblePanelExtender>
            </ContentTemplate>
        </asp:UpdatePanel>
Code:
function AdjustFrameHeight(ifr) {
    ifr.style.height = ifr.contentWindow.document.body.scrollHeight + "px";
    alert("ifr.style.height: " + ifr.style.height);          //At the point when I open the panel, this value is "0"
}