473,508 Members | 2,133 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Showmodaldialog question

Hi all,

My web app makes use of the ShowModalDialog in a couple of places. In
certain instances, the user may click on a "Cancel" image button (there is
no code-behind for this) at which point a Javascript runs which does a
window.close()

The problem is that the parent page still posts to the server when there is
clearly no need to. How can I prevent the parent from posting to the server?

Regards
John.
Nov 19 '05 #1
3 1591
change the onclick routine to "window.close;return false;"

-- bruce (sqlwork.com)
"John" <a@b.com> wrote in message
news:uh****************@TK2MSFTNGP12.phx.gbl...
Hi all,

My web app makes use of the ShowModalDialog in a couple of places. In
certain instances, the user may click on a "Cancel" image button (there is
no code-behind for this) at which point a Javascript runs which does a
window.close()

The problem is that the parent page still posts to the server when there
is clearly no need to. How can I prevent the parent from posting to the
server?

Regards
John.

Nov 19 '05 #2
Bruce,

Thanks for your quick response but I'm still having the same problem (i.e.
the page is still posting back after a window.close; return false;).

The script in my parent page is as follows:
window.showModalDialog('Lookup_Cust.aspx' ,'Customer Lookup','dialogHeight:
470px; dialogWidth: 700px; edge: Raised; center: Yes; help: No; resizable:
No; status: No; unadorned: No; scroll: No');

Even if I put 'return false;' after the showModalDialog method, the page
still posts to the server.

Any other ideas as an unnecessary post seems so, well - unnecessary?

Regards
John.
"Bruce Barker" <br******************@safeco.com> wrote in message
news:e8*************@TK2MSFTNGP15.phx.gbl...
change the onclick routine to "window.close;return false;"

-- bruce (sqlwork.com)
"John" <a@b.com> wrote in message
news:uh****************@TK2MSFTNGP12.phx.gbl...
Hi all,

My web app makes use of the ShowModalDialog in a couple of places. In
certain instances, the user may click on a "Cancel" image button (there
is no code-behind for this) at which point a Javascript runs which does a
window.close()

The problem is that the parent page still posts to the server when there
is clearly no need to. How can I prevent the parent from posting to the
server?

Regards
John.


Nov 19 '05 #3
John,

You need to set window.returnValue property in the dialog before calling
window.close(). The parent will get it as a return value of the
showModalDialog call. In returnValue you can pass any object. It may be as
simple as true or false. Preset it to false on the dialog's onload event and
change it to true when "Save" or "Ok" or whatever else positive is clicked.
In this way you protect yourself against closing the dialog with clicking x
in the right top corner.

Eliyahu

"John" <a@b.com> wrote in message
news:uh****************@TK2MSFTNGP12.phx.gbl...
Hi all,

My web app makes use of the ShowModalDialog in a couple of places. In
certain instances, the user may click on a "Cancel" image button (there is
no code-behind for this) at which point a Javascript runs which does a
window.close()

The problem is that the parent page still posts to the server when there is clearly no need to. How can I prevent the parent from posting to the server?
Regards
John.

Nov 19 '05 #4

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

Similar topics

2
5113
by: Steve | last post by:
Hi, I've come across what appears to be a bug in the rendering engine of internet explorer when a document is opened by showModalDialog. Basically any elements that should render to the right...
2
16112
by: Simon Storr | last post by:
Is it possible to make the parent window refresh when a modal dialog is closed? I know I can use window.opener.location.reload(true); for a 'normal' window, but this doesn't work for...
4
808
by: MW de Jager | last post by:
I want to call ShowModalDialog(...) from my C# code in the code behind page of my aspx page. I do not want to link this to a button, since I want to first do some checking myself before I call the...
5
3556
by: Tmajarov | last post by:
Haven't been able to find a clear answer to this... I am building an asp.net application and trying to enforce some work flow by displaying a form via the showmodaldialog method. I can get the...
3
3077
by: johkar | last post by:
Just want a verification of logic. This seems to work for IE and Firefox, but I wonder if it would be a problematic test in any of the other latest browsers? Is the use of the "window" object...
1
3058
by: Zak Lomakus | last post by:
Hi, From my main page (default.aspx) I am calling another .aspx (e.g. otherpage.aspx) page through Javascript using window.showModalDialog. otherpage.aspx has a databoud control (webchart),...
6
2604
by: David | last post by:
Hi all, I am opening a webform with showModalDialog. This appears to pop-up fine, though I have a problem... Inside the webform is a treeview control. When the treeview is populated, I am...
0
7385
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...
1
7046
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7498
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
4707
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3195
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
3182
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1558
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
766
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
418
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.