Having 2 "out of domain" pages in one aspx page with dynamic heights

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Manikrag
    New Member
    • Jun 2009
    • 62

    Having 2 "out of domain" pages in one aspx page with dynamic heights

    Hi Team,

    I have to adjust two pages which are provided by 2 diff. services based on some query string, as of now I am using iframes but could not set the height dynamically. Both the child pages can came up with any height.

    and iframes are useless in this case as I have to set some height or else it will take the defualt value for height property.

    I tried to set it thru java script and css but got the "access denied error" as java script could not do anything outside domian/application.

    Is there any other control which can be useful in such cases. If yes, how can we use it.

    Thanks,
    Manik
  • Frinavale
    Recognized Expert Expert
    • Oct 2006
    • 9749

    #2
    I don't know why you're having a problem.
    I was able to set the height and width of an iframe with both CSS and JavaScript:

    Code:
    <iframe id="theiframe" src="http://bytes.com/topic/asp-net/answers/874341-having-2-out-domain-pages-one-aspx-page-dynamic-heights#post3512844" style="height:50px; width:50px;" ></iframe>
    
    <script type="text/javascript">
       var theiframe = document.getElementById('theiframe');
       theiframe.style.width="300px";
       theiframe.style.height="500px";
    </script>
    -Frinny

    Comment

    • Manikrag
      New Member
      • Jun 2009
      • 62

      #3
      we need to set the height as per the content of the child page..you hav set it 500px..it will endup witha scroll if the child page is more thn 500px which we dont want....

      Comment

      • ssnaik84
        New Member
        • Aug 2009
        • 149

        #4
        you have to set height and width 100%
        try this

        Code:
        <html>
        <body>
        <iframe scrolling=auto id=rf src="http://bytes.com/topic/asp-net/answers/874341-having-2-out-domain-pages-one-aspx-page-dynamic-heights#post3512844" frameborder=0 allowtransparency=true style="width:100%;height:100%"></iframe>
        </body>
        </html>
        Last edited by Frinavale; Sep 22 '09, 01:08 PM. Reason: Please post code in [code] ... [/code] tags. Changed quote tags to code tags.

        Comment

        • Manikrag
          New Member
          • Jun 2009
          • 62

          #5
          its perfect whn both child pages has full content but its showing the full page evenwhen first child page has only half content..in that ways half of the page is blank

          Comment

          • Frinavale
            Recognized Expert Expert
            • Oct 2006
            • 9749

            #6
            What is the logic is for sizing the child page then?

            Comment

            • Manikrag
              New Member
              • Jun 2009
              • 62

              #7
              child page should take as much space as much the content it has..lets say if the content is till 200px and rest of the page is blank..it should take up to 200px only and second child page should start from there..

              right now by using above code - child page is taking 1000px and thn second child page is rendering..tht directly menas that there is a 800px white space between the two content

              Comment

              • ssnaik84
                New Member
                • Aug 2009
                • 149

                #8
                hmm... it's look like you are trying to merge multiple html files into one :)

                Comment

                • Frinavale
                  Recognized Expert Expert
                  • Oct 2006
                  • 9749

                  #9
                  Have you considered using percentages instead of pixels for your heights?
                  How is this dynamic? What is setting the heights?

                  Comment

                  • Manikrag
                    New Member
                    • Jun 2009
                    • 62

                    #10
                    yup, I am getting 2 output in asp and aspx format thru a webservice and as of now could not find anything to merge it

                    Comment

                    • Frinavale
                      Recognized Expert Expert
                      • Oct 2006
                      • 9749

                      #11
                      Oh wait I think I see your problem now...
                      You want to resize the IFrame according to the content within it...
                      You can't get the "size" of the content because it's in the IFrame...hmmm

                      I wonder if you could use cookies?

                      Comment

                      • Manikrag
                        New Member
                        • Jun 2009
                        • 62

                        #12
                        yes Frinavale, as i said percentage will be static again...

                        Comment

                        • Frinavale
                          Recognized Expert Expert
                          • Oct 2006
                          • 9749

                          #13
                          I'm going to move your question to the JavaScript forum. I'm not entirely sure how you would solve this problem and I think they might know (I'm certainly not a JavaScript expert).

                          I think that using a combination of Cookies and the iframes' onload event will do the trick though.

                          When the content is loaded in the iframe it'll have to set a cookie that indicates it's physical size....the onload event is fired whenever content is loaded in the iframe, at that point your code should check for the cookie and resize the iframe accordingly.

                          The trick will be timing though.....

                          Comment

                          • Manikrag
                            New Member
                            • Jun 2009
                            • 62

                            #14
                            cookies..how can we use cookies for smthing like this..

                            do we have anything thing which can be used to merge multiple page in one aspx page?

                            Comment

                            • Frinavale
                              Recognized Expert Expert
                              • Oct 2006
                              • 9749

                              #15
                              Well, you could convert the aspx pages into "content pages" and use a master page. See if you could load the 2 content pages into 2 different placeholders in the master page.

                              Comment

                              Working...