/    Sign up×
Community /Pin to ProfileBookmark

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).

to post a comment
Full-stack Developer

5 Comments(s)

Copy linkTweet thisAlerts:
@ray326Dec 17.2006 — 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.
Copy linkTweet thisAlerts:
@jbamberyauthorDec 17.2006 — 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 ?
Copy linkTweet thisAlerts:
@ray326Dec 18.2006 — 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.
Copy linkTweet thisAlerts:
@sobelitoJul 14.2008 — 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
Copy linkTweet thisAlerts:
@sobelitoJul 14.2008 — 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>
×

Success!

Help @jbambery spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.16,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...