Get IFrame Reference

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Angel

    Get IFrame Reference

    How do I get the reference of the IFrame from the asp.net webpage that is
    being displayed within that IFrame? In other words I have an IFrame in my
    page. Within that IFrame Set the source to a different asp.net page. I want
    on that page that is within the IFrame to be able to access the IFrame
    object. How can that be done? Besides the reference to the IFrame but also
    certain other objects that are in the Host page of the Iframe.

    thanks in advance...
  • Angel

    #2
    RE: Get IFrame Reference

    No not at all. I do not want to do anything with changing the source. I need
    to within the ASP.NET page that is within the IFrame to be able to Hide the
    Iframe (which is the parent) when the User clicks a button. Thats it.... How
    do I do this?

    thanks

    "Curt_C [MVP]" wrote:
    [color=blue]
    > If you want the page that's within the IFrame to be redirected just redirect
    > from that page... it will happen automatically and stay in the IFrame.
    > Now if you are saying you want the page that's inside the IFrame to redirect
    > the PARENT page you'll have to use Javascript to get the Parent ID.
    > Same from the Parent, to change the SRC for the IFrame.
    > --
    > Curt Christianson
    > site: http://www.darkfalz.com
    > blog: http://blog.darkfalz.com
    >
    >
    >
    > "Angel" wrote:
    >[color=green]
    > > How do I get the reference of the IFrame from the asp.net webpage that is
    > > being displayed within that IFrame? In other words I have an IFrame in my
    > > page. Within that IFrame Set the source to a different asp.net page. I want
    > > on that page that is within the IFrame to be able to access the IFrame
    > > object. How can that be done? Besides the reference to the IFrame but also
    > > certain other objects that are in the Host page of the Iframe.
    > >
    > > thanks in advance...[/color][/color]

    Comment

    • Curt_C [MVP]

      #3
      RE: Get IFrame Reference

      If you want the page that's within the IFrame to be redirected just redirect
      from that page... it will happen automatically and stay in the IFrame.
      Now if you are saying you want the page that's inside the IFrame to redirect
      the PARENT page you'll have to use Javascript to get the Parent ID.
      Same from the Parent, to change the SRC for the IFrame.
      --
      Curt Christianson
      site: http://www.darkfalz.com
      blog: http://blog.darkfalz.com



      "Angel" wrote:
      [color=blue]
      > How do I get the reference of the IFrame from the asp.net webpage that is
      > being displayed within that IFrame? In other words I have an IFrame in my
      > page. Within that IFrame Set the source to a different asp.net page. I want
      > on that page that is within the IFrame to be able to access the IFrame
      > object. How can that be done? Besides the reference to the IFrame but also
      > certain other objects that are in the Host page of the Iframe.
      >
      > thanks in advance...[/color]

      Comment

      • Onin Tayson

        #4
        Re: Get IFrame Reference

        Hi Angel,

        If you want to hide the frame you should declare the frame as a server
        control by adding a runat="server" attribute to the iframe control and
        assign it an ID.

        <iframe id="myFrame" runat="server" src="Default.as px" style="WIDTH:
        616px; HEIGHT: 224px"></iframe>

        On your page within the iFrame, you create a button (e.g. btnHideFrame)
        which fires a client side event when clicked (this will hide the frame).

        On your Page Load...
        btnHideFrame.At tributes.Add("o nclick", "HideFrame();") ;

        Then on your .aspx, add the codes below to handle the button's client-side
        click event

        <script>
        function HideFrame()
        {
        window.parent.d ocument.all["myFrame"].style.display = "NONE";
        }
        </script>

        HTH,


        "Angel" <Angel@discussi ons.microsoft.c om> wrote in message
        news:1DA23EDF-366B-46F4-A70D-FA79E1BB7D06@mi crosoft.com...[color=blue]
        > No not at all. I do not want to do anything with changing the source. I
        > need
        > to within the ASP.NET page that is within the IFrame to be able to Hide
        > the
        > Iframe (which is the parent) when the User clicks a button. Thats it....
        > How
        > do I do this?
        >
        > thanks
        >
        > "Curt_C [MVP]" wrote:
        >[color=green]
        >> If you want the page that's within the IFrame to be redirected just
        >> redirect
        >> from that page... it will happen automatically and stay in the IFrame.
        >> Now if you are saying you want the page that's inside the IFrame to
        >> redirect
        >> the PARENT page you'll have to use Javascript to get the Parent ID.
        >> Same from the Parent, to change the SRC for the IFrame.
        >> --
        >> Curt Christianson
        >> site: http://www.darkfalz.com
        >> blog: http://blog.darkfalz.com
        >>
        >>
        >>
        >> "Angel" wrote:
        >>[color=darkred]
        >> > How do I get the reference of the IFrame from the asp.net webpage that
        >> > is
        >> > being displayed within that IFrame? In other words I have an IFrame in
        >> > my
        >> > page. Within that IFrame Set the source to a different asp.net page. I
        >> > want
        >> > on that page that is within the IFrame to be able to access the IFrame
        >> > object. How can that be done? Besides the reference to the IFrame but
        >> > also
        >> > certain other objects that are in the Host page of the Iframe.
        >> >
        >> > thanks in advance...[/color][/color][/color]


        Comment

        Working...