title: Multiple scrollbar inside iframe asp.net c#
body: <p>I have an application built based on Admin LTE template. The application is basically an asp.net classic application. There is a master page and I have a iframe embedd in the master page.</p>
  
  <p>Based on the menu selected by the user I am loading the iframe content which will be another asp.net webpage. The child asp.net web page (iframe content page) has another iframe which is been dynamically loaded with another content.</p>
  
  <p>Totally I have 2 iframes which loads contents. The layout will be as shown in below image</p>
  
  <p><a href="https://i.stack.imgur.com/Lv40s.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Lv40s.png" alt="enter image description here"></a></p>
  
  <p>My issue is the height of the iframe is being fixed in the code and when the loaded content is more than the iframe height I am getting a scroll bar apart from the main window scroll bar. </p>
  
  <p>In order to avoid this,  I added the iframe resizer from the <a href="https://github.com/davidjbradshaw/iframe-resizer" rel="nofollow noreferrer">link</a></p>
  
  <p>And also added few javascript as shown below</p>
  
  <pre><code>function resizeIframe(obj) {
           obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px';               
         }
  </code></pre>
  
  <p>and on page load server side method i am calling the javascript using</p>
  
  <pre><code>letterframe.Attributes.Add("onload", "resizeIframe(this);");
  </code></pre>
  
  <p>as the iframe is set to runat = "server"</p>
  
  <p>This code works fine however when i have nested iframe views it didnt worked.</p>
  
  <p>hence I modified the javascript as </p>
  
  <pre><code>function resizeIframe(obj) {
           obj.style.height = (obj.contentWindow.document.body.scrollHeight + parent.document.body.scrollHeight) + 'px'; 
         }
  </code></pre>
  
  <p>This code has removed the scrollbar from the nested iframe however i am getting a blank space after my content as the height has been determined by adding the parent page height and the iframe content scroll height.</p>
  
  <p>Can anyone let me know how to fit the height so that i can avoid scrollbars in the iframe? </p>