473,473 Members | 1,976 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to close dialog box?

Hi All,
I have a question about closing a dialog box.
The thing is: I have two ASP.NET pages. From one page, I open another page
as window.showModalDialog. THere is a button on the second page. On the click
event of the button on second page, I put code "Response.Write("<script
language='javascript'> { self.close();}</script>")" or
"Response.Write("<script language='javascript'> {
window.close();}</script>")". But it doesn't work. WHen I click the button,
the page was not closed.
Any idea?
Thanks

william

Nov 19 '05 #1
8 2208
Since its a modal dialog, it lacks the ability to do a postback!
So what you should do is to use pure javascript..
Hths..
R. Thomas

"william" wrote:
Hi All,
I have a question about closing a dialog box.
The thing is: I have two ASP.NET pages. From one page, I open another page
as window.showModalDialog. THere is a button on the second page. On the click
event of the button on second page, I put code "Response.Write("<script
language='javascript'> { self.close();}</script>")" or
"Response.Write("<script language='javascript'> {
window.close();}</script>")". But it doesn't work. WHen I click the button,
the page was not closed.
Any idea?
Thanks

william

Nov 19 '05 #2
Modal dialog is just a sort of window where the browser handles a page in
absolutely normal way. There are no restrictions on postbacks whatsoever. I
have numerous dialogs with

Response.Write("<script language=\"Javascript\">window.close</script>");

and they work fine. Try removing {}.

Eliyahu

"R. Thomas [Xtreme.Net]" <re******************@hotmail.com.NoSpam> wrote in
message news:F4**********************************@microsof t.com...
Since its a modal dialog, it lacks the ability to do a postback!
So what you should do is to use pure javascript..
Hths..
R. Thomas

"william" wrote:
Hi All,
I have a question about closing a dialog box.
The thing is: I have two ASP.NET pages. From one page, I open another page as window.showModalDialog. THere is a button on the second page. On the click event of the button on second page, I put code "Response.Write("<script
language='javascript'> { self.close();}</script>")" or
"Response.Write("<script language='javascript'> {
window.close();}</script>")". But it doesn't work. WHen I click the button, the page was not closed.
Any idea?
Thanks

william

Nov 19 '05 #3
When a modal pop-up window is opened as a child window from a web-page, and a
asp button button is put on top of it, If that asp button is clicked, a
postback occurs(right?)... The unusual thing is, another window pops up... It
simply doesn't let one postback...
How are u able to achieve post back in this scenario Eliyahu?

"Eliyahu Goldin" wrote:
Modal dialog is just a sort of window where the browser handles a page in
absolutely normal way. There are no restrictions on postbacks whatsoever. I
have numerous dialogs with

Response.Write("<script language=\"Javascript\">window.close</script>");

and they work fine. Try removing {}.

Eliyahu

"R. Thomas [Xtreme.Net]" <re******************@hotmail.com.NoSpam> wrote in
message news:F4**********************************@microsof t.com...
Since its a modal dialog, it lacks the ability to do a postback!
So what you should do is to use pure javascript..
Hths..
R. Thomas

"william" wrote:
Hi All,
I have a question about closing a dialog box.
The thing is: I have two ASP.NET pages. From one page, I open another page as window.showModalDialog. THere is a button on the second page. On the click event of the button on second page, I put code "Response.Write("<script
language='javascript'> { self.close();}</script>")" or
"Response.Write("<script language='javascript'> {
window.close();}</script>")". But it doesn't work. WHen I click the button, the page was not closed.
Any idea?
Thanks

william


Nov 19 '05 #4
> When a modal pop-up window is opened as a child window from a web-page,
and a
asp button button is put on top of it, If that asp button is clicked, a
postback occurs(right?)... Right.
The unusual thing is, another window pops up...

Ah, that's what you mean. Fortunately, this problem has a very simple
solution. Just put
<base target=_self>
in the head section of the modal page.

Eliyahu
Nov 19 '05 #5
WOW!!!
My senior told me "Modal Dialogs cannot postback!!!"
In our company we have been coding keeping in mind that modal dialogs cannot
post back..
Sigh.. how many past things could I have code to be so much more elegant if
only, I had posted this question instead of blindly listening to my senior...
Thanks Eliyahu..
Regards

"Eliyahu Goldin" wrote:
When a modal pop-up window is opened as a child window from a web-page,

and a
asp button button is put on top of it, If that asp button is clicked, a
postback occurs(right?)...

Right.
The unusual thing is, another window pops up...

Ah, that's what you mean. Fortunately, this problem has a very simple
solution. Just put
<base target=_self>
in the head section of the modal page.

Eliyahu

Nov 19 '05 #6
Yes, or you could've just googled the newsgroups. This is a common question.

Eliyahu

"R. Thomas [Xtreme.Net]" <re******************@hotmail.com.NoSpam> wrote in
message news:17**********************************@microsof t.com...
WOW!!!
My senior told me "Modal Dialogs cannot postback!!!"
In our company we have been coding keeping in mind that modal dialogs cannot post back..
Sigh.. how many past things could I have code to be so much more elegant if only, I had posted this question instead of blindly listening to my senior... Thanks Eliyahu..
Regards

"Eliyahu Goldin" wrote:
When a modal pop-up window is opened as a child window from a web-page,
and a
asp button button is put on top of it, If that asp button is clicked,

a postback occurs(right?)...

Right.
The unusual thing is, another window pops up...

Ah, that's what you mean. Fortunately, this problem has a very simple
solution. Just put
<base target=_self>
in the head section of the modal page.

Eliyahu

Nov 19 '05 #7
Thanks Eliyahu, here is to you -->
http://xtremedotnet.blogdrive.com/archive/66.html

"Eliyahu Goldin" wrote:
Yes, or you could've just googled the newsgroups. This is a common question.

Eliyahu

"R. Thomas [Xtreme.Net]" <re******************@hotmail.com.NoSpam> wrote in
message news:17**********************************@microsof t.com...
WOW!!!
My senior told me "Modal Dialogs cannot postback!!!"
In our company we have been coding keeping in mind that modal dialogs

cannot
post back..
Sigh.. how many past things could I have code to be so much more elegant

if
only, I had posted this question instead of blindly listening to my

senior...
Thanks Eliyahu..
Regards

"Eliyahu Goldin" wrote:
> When a modal pop-up window is opened as a child window from a web-page, and a
> asp button button is put on top of it, If that asp button is clicked, a > postback occurs(right?)...
Right.

> The unusual thing is, another window pops up...
Ah, that's what you mean. Fortunately, this problem has a very simple
solution. Just put
<base target=_self>
in the head section of the modal page.

Eliyahu


Nov 19 '05 #8
Thank you, appreciated.

Eliyahu

"R. Thomas [Xtreme.Net]" <re******************@hotmail.com.NoSpam> wrote in
message news:E3**********************************@microsof t.com...
Thanks Eliyahu, here is to you -->
http://xtremedotnet.blogdrive.com/archive/66.html

"Eliyahu Goldin" wrote:
Yes, or you could've just googled the newsgroups. This is a common question.
Eliyahu

"R. Thomas [Xtreme.Net]" <re******************@hotmail.com.NoSpam> wrote in message news:17**********************************@microsof t.com...
WOW!!!
My senior told me "Modal Dialogs cannot postback!!!"
In our company we have been coding keeping in mind that modal dialogs

cannot
post back..
Sigh.. how many past things could I have code to be so much more elegant
if
only, I had posted this question instead of blindly listening to my

senior...
Thanks Eliyahu..
Regards

"Eliyahu Goldin" wrote:

> > When a modal pop-up window is opened as a child window from a

web-page,
> and a
> > asp button button is put on top of it, If that asp button is
clicked, a
> > postback occurs(right?)...
> Right.
>
> > The unusual thing is, another window pops up...
> Ah, that's what you mean. Fortunately, this problem has a very

simple > solution. Just put
> <base target=_self>
> in the head section of the modal page.
>
> Eliyahu
>
>
>


Nov 19 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Jonan | last post by:
Hi, I use JavaScript I have tree windows. Jonan1.html has this code erref1=window.open("Jonan2.html", "mypage",null); This opens Jonan2.html and it has this code...
6
by: chon | last post by:
I have an ASP page that is sent a file location as a parameter. It opens this file, loads the ADODB.Stream object and does a binary write to the page forcing the download dialog to appear. This...
1
by: Walter Beierdonck | last post by:
Hi, I've written a script dat has to run with a windows-shortcut... ex: http://www.domein.com/script.php This is my script: <html> <head> <script> var howLong = 2000;
1
by: dibyendu_k | last post by:
Hi, There is a problem i cant solve regarding Internet Explorer 5.5. It is regarding the Print Dialog Box. From a webpage if I open a popup window (window.open()) containing buttons Print and...
1
by: Grey | last post by:
I use window.showModalDialog("AddBoktype.aspx") to create the dialog window. When I use a button, ASP.NET server control button, to close with btnCancel.Attributes.Add("OnClick","window.close();")....
0
by: **Developer** | last post by:
The following is from the docs. But what about if the form executes Me.Close. I experimented a little but can't be sure. Is the Close Method called? I'm not sure what is meant by the Close...
1
by: dan.c.roth | last post by:
oForm.Close() vs this.Close() in a modal dialog. oFrom.Close() calls Form.Dispose() but this.Close() ,say in the click event of the Form, does not. I can think of the reason for this but is...
7
by: Toccoa | last post by:
After considerable googling - I mean searching with Google(r) - I could not find javascript on a button or <a href=... to close a window in the latest versions of IE and FireFox. There seemed...
1
by: saxtunes | last post by:
Hello, I have a problem I have been dealing with for a couple of days now.. any help would be greatly appreciated. I have an SDI Application that opens first with appearance of a Dialog box.. ...
7
by: Sin Jeong-hun | last post by:
I have a dialog form which pops up from the main window using the ShowDialog() method. this dialog has no or button, and it has quite a lot of controls on it. Now, I want to close this dialog...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.