I have an iFrame in Dynamics CRM (2011 on premise) which contains an aspx file which loads transaction line items (like an invoice line item). The quantity of line items is highly variable, from 1 to 8,000. I need to adjust the height of the iFrame so it doesn't show the vertical scroll bars. How can I achieve this? Right now I'm using this JS function but it's highly inaccurate:
function setIframeHeight() {
var rowcount = getRowCount();
var multiplier = 19;
if (rowcount < 25) {
multiplier = 13;
}
else if (rowcount > 50) {
multiplier = 23;
}
else if (rowcount > 150) {
multiplier = 32;
}
window.parent.parent.frames[0].document.getElementById('IFRAME_TransactionProduct_RA_d').parentNode.height = rowcount * multiplier;
}