Using JavaScript and Response.Redirect

  • Thread starter Thread starter ruca
  • Start date Start date
R

ruca

I have a .JS file that opens a popup window.


Here is the question...

I have a DataGrid with a select command that in this case, when I choose
"Select", I want to open my popup window.
The question is if I can do something like this in the function that is the
target of select command of datagrid:

Response.Redirect("javascript:CreateWnd('somefile.aspx', 600, 200, false);")

Or what is the solution for that?
 
no, for several reasons.

1) there is no CreateWnd function in javascript, you might want to look at
window.open().
2) using the redirect would leave the current window displaying [object]
3) while you could code it:

<script>window.open('somefile.aspx','_blank');</script>

which you can find examples on this newsgroup, I don't recommend it because
pop blockers, including the next security release for IE will prevent it
from working.


popup windows should only be opened by client script while inside a onclick
event.


-- bruce (sqlwork.com)
 
I don't think that you understand what I'm trying to said.
I know that don't exist any CreateWnd (...) function in javascript. This
function it is mine and it's included in my .JS file that I talk in previous
e-mail.
Now.... what I want to know it's if there is anyway to call one function of
javasrcipt in my code source and not in HTML source.

Hope this helps you to understant what I mean.


--
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca

bruce barker said:
no, for several reasons.

1) there is no CreateWnd function in javascript, you might want to look at
window.open().
2) using the redirect would leave the current window displaying [object]
3) while you could code it:

<script>window.open('somefile.aspx','_blank');</script>

which you can find examples on this newsgroup, I don't recommend it because
pop blockers, including the next security release for IE will prevent it
from working.


popup windows should only be opened by client script while inside a onclick
event.


-- bruce (sqlwork.com)



ruca said:
I have a .JS file that opens a popup window.


Here is the question...

I have a DataGrid with a select command that in this case, when I choose
"Select", I want to open my popup window.
The question is if I can do something like this in the function that is the
target of select command of datagrid:

Response.Redirect("javascript:CreateWnd('somefile.aspx', 600, 200, false);")

Or what is the solution for that?


--
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca
 
well, client code only runs in the browser, so you have to send back html
that includes the script command. in the code behind you use
RegisterClientScriptBlock, but this just add the js call to the output
stream. the HTTP protocol does not support server to client calls.


-- bruce (sqlwork.com)





ruca said:
I don't think that you understand what I'm trying to said.
I know that don't exist any CreateWnd (...) function in javascript. This
function it is mine and it's included in my .JS file that I talk in previous
e-mail.
Now.... what I want to know it's if there is anyway to call one function of
javasrcipt in my code source and not in HTML source.

Hope this helps you to understant what I mean.


--
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca

bruce barker said:
no, for several reasons.

1) there is no CreateWnd function in javascript, you might want to look at
window.open().
2) using the redirect would leave the current window displaying [object]
3) while you could code it:

<script>window.open('somefile.aspx','_blank');</script>

which you can find examples on this newsgroup, I don't recommend it because
pop blockers, including the next security release for IE will prevent it
from working.


popup windows should only be opened by client script while inside a onclick
event.


-- bruce (sqlwork.com)



ruca said:
I have a .JS file that opens a popup window.


Here is the question...

I have a DataGrid with a select command that in this case, when I choose
"Select", I want to open my popup window.
The question is if I can do something like this in the function that
is
the
target of select command of datagrid:

Response.Redirect("javascript:CreateWnd('somefile.aspx', 600, 200, false);")

Or what is the solution for that?


--
Programming ASP.NET with VB.NET
Thank's (if you try to help me)
Hope this help you (if I try to help you)
ruca
 
Back
Top