Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. iframe auto resize

iframe auto resize

Scheduled Pinned Locked Moved Web Development
csharpjavascripthelpquestion
9 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    oceanexplorer
    wrote on last edited by
    #1

    Hi, Ok I am currently in the phase of transforming an application fromn classic asp to .net. However its going to be phased so we currently have the set up below: ClassicAspPage ---> iframe ----> aspx Page I have written a javascript function that automatically resizes the iframe according to the content of the page loaded, this is done on the OnLoad event of the iframe by calling window.parent.autoIframeResize(iframeId) and it works brilliantly. However what I need to do is call this from within the aspx page as whats happening is the page changes according to options or validators, and the page currently gets cut off in the iframe as it grows too large. I need to call the resize function on those options or when the page validates so it resizes the frame again to fit the content. How would I bubble up to the javascipt function that is on the Classic ASP page? I have tried: window.top.autoIframeResize(iframeId) window.parent.parent.autoIframeResize(iframeId) but have had no luck so far, if anyone could help that would be great :) Regards Paul

    L 1 Reply Last reply
    0
    • O oceanexplorer

      Hi, Ok I am currently in the phase of transforming an application fromn classic asp to .net. However its going to be phased so we currently have the set up below: ClassicAspPage ---> iframe ----> aspx Page I have written a javascript function that automatically resizes the iframe according to the content of the page loaded, this is done on the OnLoad event of the iframe by calling window.parent.autoIframeResize(iframeId) and it works brilliantly. However what I need to do is call this from within the aspx page as whats happening is the page changes according to options or validators, and the page currently gets cut off in the iframe as it grows too large. I need to call the resize function on those options or when the page validates so it resizes the frame again to fit the content. How would I bubble up to the javascipt function that is on the Classic ASP page? I have tried: window.top.autoIframeResize(iframeId) window.parent.parent.autoIframeResize(iframeId) but have had no luck so far, if anyone could help that would be great :) Regards Paul

      L Offline
      L Offline
      led mike
      wrote on last edited by
      #2

      oceanexplorer wrote:

      I have written a javascript function that automatically resizes the iframe according to the content of the page loaded

      oceanexplorer wrote:

      However what I need to do is call this from within the aspx page

      ummmm aspx runs on the "server"

      O 1 Reply Last reply
      0
      • L led mike

        oceanexplorer wrote:

        I have written a javascript function that automatically resizes the iframe according to the content of the page loaded

        oceanexplorer wrote:

        However what I need to do is call this from within the aspx page

        ummmm aspx runs on the "server"

        O Offline
        O Offline
        oceanexplorer
        wrote on last edited by
        #3

        Well yes it does but you can also have client side functionality on an aspx page,and all I need is to be able to call a javascript function that resides on the ClassicAsp page that resizes the fram according to the currently loaded content.

        L 1 Reply Last reply
        0
        • O oceanexplorer

          Well yes it does but you can also have client side functionality on an aspx page,and all I need is to be able to call a javascript function that resides on the ClassicAsp page that resizes the fram according to the currently loaded content.

          L Offline
          L Offline
          led mike
          wrote on last edited by
          #4

          I am still not sure what you are saying. You cannot call a client side javascript from aspx code running on the server.

          O 1 Reply Last reply
          0
          • L led mike

            I am still not sure what you are saying. You cannot call a client side javascript from aspx code running on the server.

            O Offline
            O Offline
            oceanexplorer
            wrote on last edited by
            #5

            Ok I'll explain a little more. I currently have a javascript funtion that on the OnLoad event of the iframe automatically resizes an iframe sat in a ClassicASP page according to the content that is loaded into the iframe. The iframe is rendering ASPX pages. What I need to do in the ASPX page is call the Javascript function from a imagebutton using the OnClientClick event, this event allows a Client side event to fired on an asp control. The reason I want to do this, is for example, I try to click next but the client side validators and validatesummary prevent the page in the iframe from going forward, lots of error messages appear in the validation summary, this pushes the content in the iframe down and off the frame, what i need to do is to get the iframe to resize itself according to the new content. So I need to call the javascript function that I created, but I have no idea how to access it from the ASPX page, i.e. bubble up from the ASPX page to the iframe, to the classic ASP page where the javascipt function resides. Hope that explains a little better :) Paul What

            L 1 Reply Last reply
            0
            • O oceanexplorer

              Ok I'll explain a little more. I currently have a javascript funtion that on the OnLoad event of the iframe automatically resizes an iframe sat in a ClassicASP page according to the content that is loaded into the iframe. The iframe is rendering ASPX pages. What I need to do in the ASPX page is call the Javascript function from a imagebutton using the OnClientClick event, this event allows a Client side event to fired on an asp control. The reason I want to do this, is for example, I try to click next but the client side validators and validatesummary prevent the page in the iframe from going forward, lots of error messages appear in the validation summary, this pushes the content in the iframe down and off the frame, what i need to do is to get the iframe to resize itself according to the new content. So I need to call the javascript function that I created, but I have no idea how to access it from the ASPX page, i.e. bubble up from the ASPX page to the iframe, to the classic ASP page where the javascipt function resides. Hope that explains a little better :) Paul What

              L Offline
              L Offline
              led mike
              wrote on last edited by
              #6

              oceanexplorer wrote:

              What I need to do in the ASPX page is call the Javascript function from a imagebutton using the OnClientClick event, this event allows a Client side event to fired on an asp control.

              If you mean a button in the html inside the IFrame then you need to do what is called "cross frame scripting".

              oceanexplorer wrote:

              how to access it from the ASPX page, i.e. bubble up from the ASPX page to the iframe, to the classic ASP page where the javascipt function resides.

              you need to stop saying that. It is very confusing. In the browser there is no ASP or ASPX just HTML and Javascript. As stated above, if I understand you correctly, you need to look into cross frame scripting tips on the net[^].

              O 1 Reply Last reply
              0
              • L led mike

                oceanexplorer wrote:

                What I need to do in the ASPX page is call the Javascript function from a imagebutton using the OnClientClick event, this event allows a Client side event to fired on an asp control.

                If you mean a button in the html inside the IFrame then you need to do what is called "cross frame scripting".

                oceanexplorer wrote:

                how to access it from the ASPX page, i.e. bubble up from the ASPX page to the iframe, to the classic ASP page where the javascipt function resides.

                you need to stop saying that. It is very confusing. In the browser there is no ASP or ASPX just HTML and Javascript. As stated above, if I understand you correctly, you need to look into cross frame scripting tips on the net[^].

                O Offline
                O Offline
                oceanexplorer
                wrote on last edited by
                #7

                Hi Mike, Thanks for all your help it is much appreciated. I actually need to use cross fram scripting in another section. I'm not entirely sure its what I need as all I am trying to do is access Javascript function in the container page of an iframe. Sorry to use ASPX & ASP terminolgy, that is how I refer to them as they are technically ASPX pages (or ASP) not pure HTML (.htm), just it contains HTML, Javascript and a reference to the Codebehind file (i.e .CS). But I can understand why its confusing as you are refering to ASPX being purely the server side code section, but thats actually known as the Codebehind file. Anyway I digress. Thanks for your help, most appreicated. Paul

                L 1 Reply Last reply
                0
                • O oceanexplorer

                  Hi Mike, Thanks for all your help it is much appreciated. I actually need to use cross fram scripting in another section. I'm not entirely sure its what I need as all I am trying to do is access Javascript function in the container page of an iframe. Sorry to use ASPX & ASP terminolgy, that is how I refer to them as they are technically ASPX pages (or ASP) not pure HTML (.htm), just it contains HTML, Javascript and a reference to the Codebehind file (i.e .CS). But I can understand why its confusing as you are refering to ASPX being purely the server side code section, but thats actually known as the Codebehind file. Anyway I digress. Thanks for your help, most appreicated. Paul

                  L Offline
                  L Offline
                  led mike
                  wrote on last edited by
                  #8

                  oceanexplorer wrote:

                  I'm not entirely sure its what I need as all I am trying to do is access Javascript function in the container page of an iframe.

                  Have I understood you? From an event inside the IFrame Page yes? That is why it is crossframe scripting. The "container" of an IFrame is a Frame, see, two different frames and therefore crossframe scripting.

                  oceanexplorer wrote:

                  they are technically ASPX pages (or ASP) not pure HTML

                  Not when they are in the browser, then it is pure HTML, CSS and Javascript and some XML. The browser does not know anything about ASP or JSP or ASPX or Ruby or Python or any other server side technology.

                  oceanexplorer wrote:

                  but thats actually known as the Codebehind file. Anyway I digress.

                  Not at all. Since I only started doing web development in 1994 using C on Unix and Apache I am new to it and could use a few pointers. :laugh: [that was sarcasm]. You can do an entire page in a .ASPX file without any codebehind file so your statement is ... well wrong. ASPX "is" server side technology, period.

                  O 1 Reply Last reply
                  0
                  • L led mike

                    oceanexplorer wrote:

                    I'm not entirely sure its what I need as all I am trying to do is access Javascript function in the container page of an iframe.

                    Have I understood you? From an event inside the IFrame Page yes? That is why it is crossframe scripting. The "container" of an IFrame is a Frame, see, two different frames and therefore crossframe scripting.

                    oceanexplorer wrote:

                    they are technically ASPX pages (or ASP) not pure HTML

                    Not when they are in the browser, then it is pure HTML, CSS and Javascript and some XML. The browser does not know anything about ASP or JSP or ASPX or Ruby or Python or any other server side technology.

                    oceanexplorer wrote:

                    but thats actually known as the Codebehind file. Anyway I digress.

                    Not at all. Since I only started doing web development in 1994 using C on Unix and Apache I am new to it and could use a few pointers. :laugh: [that was sarcasm]. You can do an entire page in a .ASPX file without any codebehind file so your statement is ... well wrong. ASPX "is" server side technology, period.

                    O Offline
                    O Offline
                    oceanexplorer
                    wrote on last edited by
                    #9

                    Ok I stand corrected :) Thanks for all your help, not had chance to try the cross frame scripting as have been away for a few days. Regards Paul

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups