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'></script>";
if (CChanged || EChanged)
{
  refreshContentJS += "<script>refreshCont()</script>";  
}
Response.Write(refreshContentJS);

and the helper.js has following fucntion...

function refreshCont () {
      window.parent.frames['content'].location = '../Welcome.aspx';
}

im getting following error

window.parent.frame.content 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
aspnetdevAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
aescntConnect With a Mentor Commented:
...If that's the case, try window.opener.top.frames['content'].location.
0
 
viveksgCommented:
If you want to execute the javascript, you better write

RegisterStartupScript("key","<script>refreshCont()</script>");

and keep the function refreshCont() in your js file.
0
 
aescntCommented:
is "window.parent.frame.content 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.content" is referenced. Is the first snippet a server-side JScript, by the way?
0
Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
viveksgCommented:
To be more clear,

HTML
====
<head>
<script src='../../Scripts/Helper.js'></script>
<script>
function refreshCont () {
     window.parent.frames['content'].location = '../Welcome.aspx';
}
</script>
</head>

CODE-BEHIND
=========
RegisterStartupScript("key","<script>refreshCont()</script>");
0
 
aspnetdevAuthor Commented:
yep thts server side
0
 
aspnetdevAuthor Commented:
Viveksg ..i get the same error...ur solution does not work
0
 
viveksgCommented:
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].location = '../Welcome.aspx';
0
 
aspnetdevAuthor Commented:
frames['content'] is the name of frame
0
 
aescntCommented:
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'].location. :)
0
 
aspnetdevAuthor Commented:
That does not work either....i tried this and still i get the error   window.parent.frame.content is null or not an object.


if (CChanged || EChanged)
{
     Response.Write("<script>window.parent.frames['content'].location='../Welcome.aspx';</script>");
}

where content is the name of the frame where all pages are displayed...urgent help wud be appreciated ..thanks
0
 
aspnetdevAuthor Commented:
i also tried
opener.frames['content'].location='../Welcome.aspx'
but same error
0
 
aescntCommented:
If you get the "same" error, i.e., "window.parent.frame.content is null or not an object", perhaps it's saying that we're fixing the wrong thing.
0
 
aspnetdevAuthor Commented:
but if i debug it ....i breaks at window.parent.frames['content'].location  and gives the error.
0
 
aescntCommented:
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...></frameset> code?
0
 
aspnetdevAuthor Commented:
<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>
0
 
aspnetdevAuthor Commented:
actually its a pop up window...in where if EChanged or Cchanged then the parent page content frame should be redirected to welcom.aspx
0
 
aescntCommented:
So let me get this -- the frame page contains top.aspx/menu.aspx/welcome.aspx/bottom.aspx -- and then one of these pages calls a popup window, that contains the code in your question?
0
 
aspnetdevAuthor Commented:
...i did that too aescnt....man this is really gettin on my nerves....dont understand whts the pbm
0
 
aspnetdevAuthor Commented:
kool it works aescnt ...actually  i was forgetting to put window
--Thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.