By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,086 Members | 1,442 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,086 IT Pros & Developers. It's quick & easy.

Get IFrame Reference

P: n/a
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...
Nov 19 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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:
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:
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...

Nov 19 '05 #2

P: n/a
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:
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...

Nov 19 '05 #3

P: n/a
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.aspx" 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.Attributes.Add("onclick", "HideFrame();");

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

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

HTH,
"Angel" <An***@discussions.microsoft.com> wrote in message
news:1D**********************************@microsof t.com...
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:
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:
> 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...

Nov 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.