Reputation: 28665
I have a page that has an iframe
From one of the pages within the iframe I want to look back and make a panel on the default page invisible because it is overshadowing a popup
I tried using Parent.FindControl but it does not seem to be working. I am positive I have the right id in the findcontrol because I used Firebug to inspect the panel and I copied the id from there
Does anyone know what I am missing?
Upvotes: 1
Views: 7384
Reputation: 21727
Parent document:
<body>
<input type="text" id="accessme" value="Not Accessed" />
...
</body>
Document in iframe:
<head>
...
<script type="text/javascript">
function setValueOfAccessme()
{
window.parent.document.getElementById("accessme").value = "Accessed";
}
</script>
</head>
<body onload="setValueOfAccessme();">
</body>
The document inside the iframe accesses the document object
on the window object
on load, and uses the getElementId()
function to set the value of the input inside the body of the parent document.
Upvotes: 2
Reputation: 1711
Alternatively here's a more helpful find control routine...
Public Shared Function MoreHelpfulFindControl(ByVal parent As UI.Control, ByVal id As String) As UI.Control
If parent.ID = id Then Return parent
For Each child As UI.Control In parent.Controls
Dim recurse As UI.Control = MoreHelpfulFindControl(child, id)
If recurse IsNot Nothing Then Return recurse
Next
Return Nothing
End Function
Upvotes: 0
Reputation: 621
I didn't completely follow your problem, but I'll take my best shot.
It sounds like you have an ASP.NET page, that has an iframe in it that refers to another ASP.NET page, and in that page that was requested by the iframe you want to modify the visibility of the item contained in the page that contains the iframe.
If my understanding of your problem is correct, then you have some somewhat nasty problems here.
So you have some alternatives here:
Upvotes: 3