Click here to Skip to main content
Rate this: bad
Please Sign up or sign in to vote.
See more: C# ASP.NET Ajax IFrame
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).
<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).
<!-- 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 class="divContent">
            This is some text. Put the filters in here.
             <asp:Button ID="btnLobtnFilter" runat="server" Text="Apply Filter" />
        <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 2-Apr-13 14:20pm
sri senthil kumar at 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
Motley Drew at 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)

  Print Answers RSS
0 OriginalGriff 650
1 Maciej Los 525
2 Suvendu Shekhar Giri 229
3 Sascha Lefévre 229
4 Richard Deeming 195
0 Sergey Alexandrovich Kryukov 9,693
1 OriginalGriff 9,185
2 Peter Leow 5,112
3 Kornfeld Eliyahu Peter 3,373
4 Maciej Los 2,876

Advertise | Privacy | Mobile
Web01 | 2.8.150327.1 | Last Updated 2 Apr 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100