I have a page with an iframe like this:
<iframe runat="server" id="rsPrintFrame" src="framedPage.aspx" height="0" width="0"></iframe>
I need to get access to a component on the 'framed' page from the parent page, as one would typically do with $find()
or Sys.Application.findComponent()
. But obviously I can't simply do: myFrame.contentWindow.document.$find()
.
I've come up with a work-around involving making the $find()
call in the framed page and saving it to a variable accessible to the parent page via javascript.
But is there a straightforward way to call findComponent()
from the parent page while targeting a framed page's element/component.
BTW, getElementById()
is not an acceptable solution.
Is something like this what you're looking for?
window.frames['<%= rsPrintFrame.ClientID %>'].document....
As far as I know you cannot use the $find from the parent window to find a component in the child window. You can do this however:
var component = myFrame.contentWindow.$find("myComponentId");
If you are using this often you can create a wrapper function.