aspnetdev
asked on
Refreshing the Frame
Hi,
I have the following javascrpt where i have to refresh my Middle frame on condition.im using the following script but its giving error
string refreshContentJS;
refreshContentJS = "<script src='../../Scripts/Helper. js'></scri pt>";
if (CChanged || EChanged)
{
refreshContentJS += "<script>refreshCont()</sc ript>";
}
Response.Write(refreshCont entJS);
and the helper.js has following fucntion...
function refreshCont () {
window.parent.frames['cont ent'].loca tion = '../Welcome.aspx';
}
im getting following error
window.parent.frame.conten t is null or not an object.
i just want to redirect the content frame to welcome.aspx on tht "if " condition...can anhyone help me out.urgent
thanks
I have the following javascrpt where i have to refresh my Middle frame on condition.im using the following script but its giving error
string refreshContentJS;
refreshContentJS = "<script src='../../Scripts/Helper.
if (CChanged || EChanged)
{
refreshContentJS += "<script>refreshCont()</sc
}
Response.Write(refreshCont
and the helper.js has following fucntion...
function refreshCont () {
window.parent.frames['cont
}
im getting following error
window.parent.frame.conten
i just want to redirect the content frame to welcome.aspx on tht "if " condition...can anhyone help me out.urgent
thanks
is "window.parent.frame.conte nt is null or not an object." the error message in verbatim? if so, then the error is not in the script you gave, it might be somewhere else where "window.parent.frame.conte nt" is referenced. Is the first snippet a server-side JScript, by the way?
To be more clear,
HTML
====
<head>
<script src='../../Scripts/Helper. js'></scri pt>
<script>
function refreshCont () {
window.parent.frames['cont ent'].loca tion = '../Welcome.aspx';
}
</script>
</head>
CODE-BEHIND
=========
RegisterStartupScript("key ","<script >refreshCo nt()</scri pt>");
HTML
====
<head>
<script src='../../Scripts/Helper.
<script>
function refreshCont () {
window.parent.frames['cont
}
</script>
</head>
CODE-BEHIND
=========
RegisterStartupScript("key
ASKER
yep thts server side
ASKER
Viveksg ..i get the same error...ur solution does not work
try giving the frame number.
like if you have top frame, left frame and middle frame, and you are trying to change the middleframe from left frame, then give window.parent.frames[2].lo cation = '../Welcome.aspx';
like if you have top frame, left frame and middle frame, and you are trying to change the middleframe from left frame, then give window.parent.frames[2].lo
ASKER
frames['content'] is the name of frame
frames['content'] should suffice if the parent page has a frame named "content." Kind of a blind guess here, but maybe it's not the topmost frame; you can try window.top.frames['content '].locatio n. :)
ASKER
That does not work either....i tried this and still i get the error window.parent.frame.conten t is null or not an object.
if (CChanged || EChanged)
{
Response.Write("<script>wi ndow.paren t.frames[' content']. location=' ../Welcome .aspx';</s cript>");
}
where content is the name of the frame where all pages are displayed...urgent help wud be appreciated ..thanks
if (CChanged || EChanged)
{
Response.Write("<script>wi
}
where content is the name of the frame where all pages are displayed...urgent help wud be appreciated ..thanks
ASKER
i also tried
opener.frames['content'].l ocation='. ./Welcome. aspx'
but same error
opener.frames['content'].l
but same error
If you get the "same" error, i.e., "window.parent.frame.conte nt is null or not an object", perhaps it's saying that we're fixing the wrong thing.
ASKER
but if i debug it ....i breaks at window.parent.frames['cont ent'].loca tion and gives the error.
Maybe this can help you debug:
if (!window.parent) { alert("There is no parent.");
if (!window.parent.frames) { alert("There is no frames in this window's parent.");
var frms = '';
for (var i in window.parent.frames) { frms += i + '/'; }
alert("The frames of the parent window are: " + frms);
Also, may we see your <framset><frame...></frame set> code?
if (!window.parent) { alert("There is no parent.");
if (!window.parent.frames) { alert("There is no frames in this window's parent.");
var frms = '';
for (var i in window.parent.frames) { frms += i + '/'; }
alert("The frames of the parent window are: " + frms);
Also, may we see your <framset><frame...></frame
ASKER
<frameset rows="64,86%,17" framespacing="0" frameborder="0">
<frame name="topFrame" style="CURSOR: n-resize; BORDER-BOTTOM: black 1px solid" scrolling="no"
noresize src="top.aspx">
<frameset cols="166,83%">
<frame name="left-frame" style="BORDER-RIGHT: #000000 1px solid; CURSOR: e-resize" target="right-frame"
src="menu.aspx">
<frame name="content" DESIGNTIMEDRAGDROP="10" src="Welcome.aspx" >
</frameset>
<frame name="bottom-frame" style="BORDER-TOP: #000000 1px solid; CURSOR: n-resize" scrolling="no"
target="right-frame" src="bottom.aspx" DESIGNTIMEDRAGDROP="574">
</frameset>
<frame name="topFrame" style="CURSOR: n-resize; BORDER-BOTTOM: black 1px solid" scrolling="no"
noresize src="top.aspx">
<frameset cols="166,83%">
<frame name="left-frame" style="BORDER-RIGHT: #000000 1px solid; CURSOR: e-resize" target="right-frame"
src="menu.aspx">
<frame name="content" DESIGNTIMEDRAGDROP="10" src="Welcome.aspx" >
</frameset>
<frame name="bottom-frame" style="BORDER-TOP: #000000 1px solid; CURSOR: n-resize" scrolling="no"
target="right-frame" src="bottom.aspx" DESIGNTIMEDRAGDROP="574">
</frameset>
ASKER
actually its a pop up window...in where if EChanged or Cchanged then the parent page content frame should be redirected to welcom.aspx
So let me get this -- the frame page contains top.aspx/menu.aspx/welcome .aspx/bott om.aspx -- and then one of these pages calls a popup window, that contains the code in your question?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
...i did that too aescnt....man this is really gettin on my nerves....dont understand whts the pbm
ASKER
kool it works aescnt ...actually i was forgetting to put window
--Thanks
--Thanks
RegisterStartupScript("key
and keep the function refreshCont() in your js file.