Click here to Skip to main content
15,885,954 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have two iFrames in my web application. The first is a header that contains some buttons, the second is the main content window.

I am trying to click a button in iFrame1 and open a ModalPanel in iFrame2. I imagine others have run into this before. I realize iFrames are not always the best way to go, but I have a music player in my top frame, and I want to keep it playing while users navigate the site.

I'm basically looking for some type of Target attribute to reference iFrame2 as the target, but I'm not having any luck. I found a few hits regarding jQuery, but I have not learned jQuery yet, so I'm stuck with JavaScript, HTML & C# until then.

This is the button I'm using to open the model window in my header frame (iFrame1).

XML
<asp:ImageButton ID="plyrFilter" runat="server" ImageUrl="images/plyrFilter.gif" onmouseover="plyrToolTip('Filter Genre')" onmouseout="plyrToolTip('')" />


This is the model in my header frame (iFrame1).

XML
<!-- Popup Window for filter -->
        <asp:Panel ID="ModalPanel" runat="server" Width="300px">
        <div class="modalPopupWrapper">
            <div class="divCloseBtn"><asp:ImageButton ID="OKButton" runat="server" ImageUrl="~/images/modalClose.png" /></div>
            </div>

            <div class="divContent">
            This is some text. Put the filters in here.

             <asp:Button ID="btnLobtnFilter" runat="server" Text="Apply Filter" />

             </div>
        </asp:Panel>
        <ajaxToolkit:ModalPopupExtender ID="mpe" runat="server"  TargetControlId="plyrFilter" BackgroundCssClass="modalBackground"
        PopupControlID="ModalPanel" OkControlID="OKButton" />
    <!-- Popup Window for filter end -->


Of course this just opens the model window in the header iFrame. How can I get this to open in the main content iFrame (iFrame2)?
Posted
Comments
sri senthil kumar 3-Apr-13 6:48am    
You can achieve this but do you have 2 iframes or one parent page and an iframe page?
if u have 2 iframes then you have to call a method in parent page > and from there again u can call a method in another iframe page.
Else if you have a parent page and an iframe page call is pretty simple jus iframe to parent and parent to iframe.
check this link for details on using parent-iframe(to-fro) accessing http://witstuner.blogspot.in/2013/03/accessing-parent-child-iframe-from-one.html
Motley Drew 11-Apr-13 2:28am    
Thank you for your reply Sri. I did not have any luck with this method. I was able to design around it, but quickly ran into the same issue with a panel expander. I have my Default.aspx page which contains 2 iFrames, 1 for the header and one for the body. I need to click a button in the header.aspx to expand a panel in the body.aspx. The extender panel ties to a control, but it can't see the control in the other iFrame.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900