www.webdeveloper.com
Results 1 to 6 of 6

Thread: prevent Iframe refresh when in asp master page

  1. #1
    Join Date
    Nov 2006
    Posts
    5

    prevent Iframe refresh when in asp master page

    I have an iframe in a content placeholder in an asp master page. The problem I am having is that everytime I open a new page that uses the master page as a reference it causes a complete page refresh including my iframe. Does anyone know how I can prevent the refresh on the iframe page alone. The iframe has an embedded media player that I do not want refreshed as the refresh keeps starting my music over again and I want it to play continuously as users browse through the site (unless of course if they turn the music off).

  2. #2
    Join Date
    Nov 2003
    Location
    Jerryville, Tejas
    Posts
    11,715
    An iframe isn't the right thing to use for that. You have to put the media player in a master frame in a frameset.
    "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." Brian W. Kernighan

  3. #3
    Join Date
    Nov 2006
    Posts
    5
    Thanks Ray....I had thought about that but being a relatively new at web development I had read so many horror stories about framesets that I thought I would stay away from them. But, I will give it a try if this will solve my problem. Thanks so much for the reply.

    Jim

  4. #4
    Join Date
    Nov 2003
    Location
    Jerryville, Tejas
    Posts
    11,715
    I don't recommend the use of frames (or noise on web pages) but that's the only way I know to do what you want.
    "Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." Brian W. Kernighan

  5. #5
    Join Date
    Jul 2008
    Posts
    2

    Any updates?

    Hey guys.

    I know this thread is 2 years old, but...

    I am having the same issue where an iframe in contentform with a master page is refreshed on post backs, even those of ajax update panels (with update mode set to conditional) where the iand Mike are you thereframe is not supposed to reload.

    I will look at framesets, with which I am not familiar, but was wondering if you ever figured out what was going on here?

    Again, I have a page where I am required to have an iframe, and I'd like to use master pages, but the iframe in the contentform (which uses a master page) reloads on postbacks when it shouldn't. I put the same code in a page w/o a masterpage and the iframe does not reload on ajax postbacks.

    In any case, would appreciate any wisdom you might have gained.

    Best,
    Brian

  6. #6
    Join Date
    Jul 2008
    Posts
    2

    Update: My issue resolved

    Update:

    I figured out my issue.

    I am doing an async postback on page load from javascript and I was passing a javascript id that didn't include the "ctl00_ContentPlaceHolder1_" which are required bc of the master page.

    In any case, not sure I made clear what my issue/resolution were, but if you have questions, don't hesitate to ping me. Code Below:

    Thanks Again,
    Brian

    <%@ Page Language="C#" MasterPageFile="~/MasterPages/Test.master" AutoEventWireup="true" Inherits="Test" CodeBehind="Test.aspx.cs" EnableEventValidation="false" %>

    <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %>
    <asp:Content ID="Content2" ContentPlaceHolderID="head" runat="Server">

    <script language="javascript" type="text/javascript">
    <!--
    function PopulateFriendsTable() {
    var prm = Sys.WebForms.PageRequestManager.getInstance();
    prm._doPostBack('ctl00_ContentPlaceHolder1_UpdatePanel1', '');
    }

    // -->
    </script>

    </asp:Content>
    <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true" />
    <iframe id="ifmeX" runat="server" width="100%" height="550" frameborder="no" scrolling="no" allowtransparency="true" src="http://pieteip.com" />
    <asp:UpdatePanel ID="UpdatePanel1" runat="server" OnLoad="UpdatePanel1_Load" UpdateMode="Conditional" RenderMode="Block">
    <ContentTemplate>
    <asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1" DisplayAfter="1">
    <ProgressTemplate>
    <img id="imgLoading" runat="server" src="~/Images/progressbars/BigCircleGreen.gif" />
    </ProgressTemplate>
    </asp:UpdateProgress>
    <ajaxToolkit:AlwaysVisibleControlExtender ID="ace" runat="server" TargetControlID="UpdateProgress1" VerticalSide="Top" VerticalOffset="2" HorizontalSide="Right" HorizontalOffset="100" ScrollEffectDuration=".1" />
    <asp:Label ID="Label1" runat="server" Text="" CssClass="ctlGeneralSmall" Font-Bold="true" />
    <asp:Button ID="btnUpdateLabel" runat="server" Text="Update Label" OnClick="btnUpdateLabel_Click" />
    <table border="1" cellpadding="4" cellspacing="0" id="tblFacebookFriends" runat="server" bgcolor="whitesmoke" style="border-color: #808080;">
    <tr>
    <td align="center" bgcolor="#333333">
    <asp:Label ID="Label4" runat="server" Text="Friend" ForeColor="White" />
    </td>
    <td align="center" bgcolor="#333333">
    </td>
    <td align="center" bgcolor="#333333">
    </td>
    </tr>
    </table>
    <asp:HiddenField ID="hdnTblStatus" runat="server" EnableViewState="false" Value="" />
    </ContentTemplate>
    </asp:UpdatePanel>
    </asp:Content>
    <asp:Content ID="Content3" ContentPlaceHolderID="postbody" runat="Server">

    <script language="javascript">
    if ((document.getElementById('ctl00_ContentPlaceHolder1_hdnTblStatus').getAttribute('value') == null) || (document.getElementById('ctl00_ContentPlaceHolder1_hdnTblStatus').getAttribute('value') == '')){
    window.setTimeout(function() {try{PopulateFriendsTable();}catch(err){} }, 5000);
    }
    </script>

    </asp:Content>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles