By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,665 Members | 2,212 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,665 IT Pros & Developers. It's quick & easy.

How close opening window?

P: n/a
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?
Nov 18 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
This should work..

Response.Write("<script language='javascript'>window.open
('WebForm2.aspx','two','menubar=no');window.close
();</script>");
-----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?
.

Nov 18 '05 #2

P: n/a
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/lwsamplec...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" <mg@theworld.com> ???? news:0f****************************@phx.gbl...
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?

Nov 18 '05 #3

P: n/a
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" <lo*********@hotmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
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/lwsamplec...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" <mg@theworld.com> ???? news:0f****************************@phx.gbl...
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?


Nov 18 '05 #4

P: n/a
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.clo se
();</script>");
-----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?
.

.

Nov 18 '05 #5

P: n/a
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.NetCustomerControl&UserControl&Application.
ControlHelper&HelperElement for MessageBox&Dialog
ComboBox,ComboCalendar,SmartIframe
---------------------------
Remote Asp.Net Execution

"mg" <mg@theworld.com> ???? news:0f7901c3beab$87a6b380

$a*******@phx.gbl...
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?

.

Nov 18 '05 #6

P: n/a
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

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #7

P: n/a
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" <mg@theworld.com> ???? news:10*****************************@phx.gbl...
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" <mg@theworld.com> ???? news:0f7901c3beab$87a6b380

$a*******@phx.gbl...
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?

.

Nov 18 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.