How close opening window?

M

mg

Once opening WebForm2 from WebForm1 using

Response.Write("<script language='javascript'>window.open
('WebForm2.aspx','two','menubar=no');</script>");

how can I [programmatically] close WebForm1?
 
S

Suresh

This should work..

Response.Write("<script language='javascript'>window.open
('WebForm2.aspx','two','menubar=no');window.close
 
S

Scott M.

God, I hate it when someone asks a question about how to do something and
the response is to use a 3rd party tool/component when the functionality
doesn't require it.


Lostinet.Web Support said:
you can use ControlHelper to help you .
if you use it ,you won't write these scripts.
close a window?just is:
controlHelper1.CloseWindow("returnValue");

why not try?

http://www.lostinet.com/en/lwsamplecs/?framesrc=controlhelper/

--
http://www.lostinet.com/
Lostinet.Web Controls&Components help you to build better Asp.Net
CustomerControl&UserControl&Application.
ControlHelper&HelperElement for MessageBox&Dialog
ComboBox,ComboCalendar,SmartIframe
---------------------------
Remote Asp.Net Execution

mg said:
Once opening WebForm2 from WebForm1 using

Response.Write("<script language='javascript'>window.open
('WebForm2.aspx','two','menubar=no');</script>");

how can I [programmatically] close WebForm1?
 
M

mg

Thanks!

But, I failed to mention that I need to first open
WebForm2 and then close WebForm1 without the end user
having to press an OK button before the close can occur.

I'd very much appreciate knowing how to do this!
-----Original Message-----
This should work..

Response.Write("<script language='javascript'>window.open
('WebForm2.aspx','two','menubar=no');window.close
(); said:
-----Original Message-----
Once opening WebForm2 from WebForm1 using

Response.Write("<script language='javascript'>window.open
('WebForm2.aspx','two','menubar=no');</script>");

how can I [programmatically] close WebForm1?
.
.
 
M

mg

I need to first open
WebForm2 and then close WebForm1 without the end user
having to press an OK button before the close can occur.

Will controlHelper1.CloseWindow("returnValue");

accomplish this?

-----Original Message-----
you can use ControlHelper to help you .
if you use it ,you won't write these scripts.
close a window?just is:
controlHelper1.CloseWindow("returnValue");

why not try?

http://www.lostinet.com/en/lwsamplecs/? framesrc=controlhelper/

--
http://www.lostinet.com/
Lostinet.Web Controls&Components help you to build better Asp.Net
CustomerControl&UserControl&Application.
ControlHelper&HelperElement for MessageBox&Dialog
ComboBox,ComboCalendar,SmartIframe
---------------------------
Remote Asp.Net Execution

"mg" <[email protected]> ???? news:0f7901c3beab$87a6b380 [email protected]...
Once opening WebForm2 from WebForm1 using

Response.Write("<script language='javascript'>window.open
('WebForm2.aspx','two','menubar=no');</script>");

how can I [programmatically] close WebForm1?


.
 
0

090376

Hi!

You can use javascript from within your code like below!

Response.Write("<script language='javascript'>window.opener =
self</script>")
Response.Write("<script language='javascript'>window.close()</script>")

Explaination why 2 lines:

You will be prompt with a message box to confirm the closing of the
window if you are trying to close a window via javascript which hasn't
been opend by a javascript! (like you dow with your winform2.aspx)
To avoid that we set the opener to itself (which is the first line of
code) and there you go - the window is closing.

You can put that WHEREEVER in your code - so after you call the
javascript to open winform2.aspx - cut the window.close() out of that
line - you ad the new two lines as shown below
#VB
Response.Write("<script
language='javascript'>window.open('WebForm1.aspx','two','menubar=no')</s
cript>")
Response.Write("<script language='javascript'>window.opener =
self</script>")
Response.Write("<script language='javascript'>window.close()</script>")


TADA
 
L

Lostinet.Web Support

of cause. but the IE will prompt a confirm only when : the window is not
opened by another window and IE version is lower than 6

--
http://www.lostinet.com/
Lostinet.Web Controls&Components help you to build better Asp.Net
CustomerControl&UserControl&Application.
ControlHelper&HelperElement for MessageBox&Dialog
ComboBox,ComboCalendar,SmartIframe
---------------------------
Remote Asp.Net Execution

mg said:
I need to first open
WebForm2 and then close WebForm1 without the end user
having to press an OK button before the close can occur.

Will controlHelper1.CloseWindow("returnValue");

accomplish this?

-----Original Message-----
you can use ControlHelper to help you .
if you use it ,you won't write these scripts.
close a window?just is:
controlHelper1.CloseWindow("returnValue");

why not try?

http://www.lostinet.com/en/lwsamplecs/? framesrc=controlhelper/

--
http://www.lostinet.com/
Lostinet.Web Controls&Components help you to build better Asp.Net
CustomerControl&UserControl&Application.
ControlHelper&HelperElement for MessageBox&Dialog
ComboBox,ComboCalendar,SmartIframe
---------------------------
Remote Asp.Net Execution

"mg" <[email protected]> ???? news:0f7901c3beab$87a6b380 [email protected]...
Once opening WebForm2 from WebForm1 using

Response.Write("<script language='javascript'>window.open
('WebForm2.aspx','two','menubar=no');</script>");

how can I [programmatically] close WebForm1?


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top