Asp.net with Javascript Problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Below is the code.

language = asp.net/vb.net

private sub openW()

sResult = sResult & "<script language=javascript> mywindow = window.open('http://localhost/mohsaic/default.aspx?tc=Client/Manage'); "

sResult = sResult & "mywindow.parent.frames[1].location = 'http://localhost/treeview/treeview.aspx?m=c&pid=366826706'; "

sResult = sResult & "mywindow.parent.frames[0].location = 'http://localhost/mohsaic/default.aspx?tc=Client/Manage'; </script>"

Response.Write(sResult)

End Sub

I am calling this in LinkButton(asp.net servercontrol) Click event

it opens the new window and the new window has got the frames with in frames and frames with in those frames.

the above code works fine on local boxes and once the code is pushed to server(testing box), it works for 1st time and then on it stops working and i get a message "mywindow.parent.frames.1 is null or not a object error".

while pushing the localhost is made to the respective box name.

i cannot imagine a reason for working once and not working again., if anyone recall the same error before and have fixed please let me know?

any help is appriciated

Kshoot
 
First of all, are you sure you want the 'localhost' hard coded in there?
After, 'localhost' is different for every user - most of whom won't have a
web server.

The only other idea, is that this is a timing issue, that your code attempts
to set the frame's location before the window has fully opened and loaded.

krishna said:
Below is the code.

language = asp.net/vb.net

private sub openW()

sResult = sResult & "<script language=javascript> mywindow =
window.open('http://localhost/mohsaic/default.aspx?tc=Client/Manage'); "
sResult = sResult & "mywindow.parent.frames[1].location =
'http://localhost/treeview/treeview.aspx?m=c&pid=366826706'; "
sResult = sResult & "mywindow.parent.frames[0].location =
'http://localhost/mohsaic/default.aspx?tc=Client/Manage'; said:
Response.Write(sResult)

End Sub

I am calling this in LinkButton(asp.net servercontrol) Click event

it opens the new window and the new window has got the frames with in
frames and frames with in those frames.
the above code works fine on local boxes and once the code is pushed to
server(testing box), it works for 1st time and then on it stops working and
i get a message "mywindow.parent.frames.1 is null or not a object error".
while pushing the localhost is made to the respective box name.

i cannot imagine a reason for working once and not working again., if
anyone recall the same error before and have fixed please let me know?
 
I don't know, that was just a guess. It would mean that sometimes it work,
sometimes not - though I wouldnt expect it to work just once and then not at
all.

What I would do is have the child window, in its onload event, call a
function in the parent window to get the location for its frames.

Also, if the error persists, try using the debugger to see what values
various variables have, to help you figure out what the problem is.

krishna said:
Marina,

Thankx for your reply, i am getting the url from webconfig, i have
submitted the code after it is formatted, copied from the debug window, so
that it would be easier to understand in the post.
so you sid timeout issue, what would be the solution you think, do i need
to add any other code into javascript block, if so what is that ???
Krishna


Marina said:
First of all, are you sure you want the 'localhost' hard coded in there?
After, 'localhost' is different for every user - most of whom won't have a
web server.

The only other idea, is that this is a timing issue, that your code attempts
to set the frame's location before the window has fully opened and loaded.

krishna said:
Below is the code.

language = asp.net/vb.net

private sub openW()

sResult = sResult & "<script language=javascript> mywindow =
window.open('http://localhost/mohsaic/default.aspx?tc=Client/Manage'); "
sResult = sResult & "mywindow.parent.frames[1].location =
'http://localhost/treeview/treeview.aspx?m=c&pid=366826706'; "
sResult = sResult & "mywindow.parent.frames[0].location =
'http://localhost/mohsaic/default.aspx?tc=Client/Manage'; said:
Response.Write(sResult)

End Sub

I am calling this in LinkButton(asp.net servercontrol) Click event

it opens the new window and the new window has got the frames with in
frames and frames with in those frames.
the above code works fine on local boxes and once the code is pushed
to
server(testing box), it works for 1st time and then on it stops working and
i get a message "mywindow.parent.frames.1 is null or not a object error".
while pushing the localhost is made to the respective box name.

i cannot imagine a reason for working once and not working again., if
anyone recall the same error before and have fixed please let me know?
any help is appriciated

Kshoot
 
There is no reason not to be able to debug client side javascript when the
server is located elsewhere. You just get the debugger prompt and you say
yes.

krishna said:
at the first place i have written the functions as u said, there was a
problem and i was trying all kinds of ways to resolve this, as i said it was
working without hastles in the my box(all ways - function call and
response.write etc), it gives the problem once it is pushed into testing
box, there is noway we can use the debugger in the testing or production box
any more thoughts are welcome

Krishna

Marina said:
I don't know, that was just a guess. It would mean that sometimes it work,
sometimes not - though I wouldnt expect it to work just once and then not at
all.

What I would do is have the child window, in its onload event, call a
function in the parent window to get the location for its frames.

Also, if the error persists, try using the debugger to see what values
various variables have, to help you figure out what the problem is.

krishna said:
Marina,

Thankx for your reply, i am getting the url from webconfig, i have
submitted the code after it is formatted, copied from the debug window, so
that it would be easier to understand in the post.
so you sid timeout issue, what would be the solution you think, do i
need
to add any other code into javascript block, if so what is that ???
Krishna


:

First of all, are you sure you want the 'localhost' hard coded in there?
After, 'localhost' is different for every user - most of whom won't have a
web server.

The only other idea, is that this is a timing issue, that your code attempts
to set the frame's location before the window has fully opened and loaded.

Below is the code.

language = asp.net/vb.net

private sub openW()

sResult = sResult & "<script language=javascript> mywindow =
window.open('http://localhost/mohsaic/default.aspx?tc=Client/Manage'); "

sResult = sResult & "mywindow.parent.frames[1].location =
'http://localhost/treeview/treeview.aspx?m=c&pid=366826706'; "

sResult = sResult & "mywindow.parent.frames[0].location =
'http://localhost/mohsaic/default.aspx?tc=Client/Manage'; </script>"

Response.Write(sResult)

End Sub

I am calling this in LinkButton(asp.net servercontrol) Click event

it opens the new window and the new window has got the frames with in
frames and frames with in those frames.

the above code works fine on local boxes and once the code is
pushed
to
server(testing box), it works for 1st time and then on it stops
working
and
i get a message "mywindow.parent.frames.1 is null or not a object error".

while pushing the localhost is made to the respective box name.

i cannot imagine a reason for working once and not working again., if
anyone recall the same error before and have fixed please let me know?

any help is appriciated

Kshoot
 
Back
Top