pnduke
pnduke

Reputation: 183

Setting iFrame height programmatically in Dynamics CRM 2011

In Dynamics CRM, how do you set the height of an iframe programmatically? The following function doesn't do anything, the iframe always comes up the same size. Even when you go to iframe properties and change the row numbers there, it still doesn't cause any changes in size.

 function doOnLoad(sender, args) {
         setIframeHeight();
 }

 function setIframeHeight() {
     //lowest control in iframe
     var element = $('btnInsert');

     //the following line gets called, and what's displayed is 25
     alert(window.parent.parent.frames[0].document.getElementById('IFRAME_TransactionProduct_RA_d').parentNode.height); 

     //the following line doesn't do anything         
     window.parent.parent.frames[0].document.getElementById('IFRAME_TransactionProduct_RA_d').parentNode.height = 5000000; 
 }

Upvotes: 0

Views: 1926

Answers (2)

raN1star
raN1star

Reputation: 30

you may try this in iframe code:

//set div(show iframe) height = iframe body height * 1.2 window.parent.parent.frames[0].document.getElementById('IFRAME_ApprovalProcess_d').style["height"] = ($(body * 1.2)) + "px";

//but it may get some issue if the contenter in the form not load,so that window.parent.parent.frames[0].document.getElementById('IFRAME_ApprovalProcess_d') this can be undifined.

Upvotes: 1

Pedro Azevedo
Pedro Azevedo

Reputation: 2507

To get the height of a element you can do like you have but to set you have use style, like that:

parentNode.style.height = "100px";

Upvotes: 0

Related Questions