473,763 Members | 6,772 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 1600
change the onclick routine to "window.close;r eturn false;"

-- bruce (sqlwork.com)
"John" <a@b.com> wrote in message
news:uh******** ********@TK2MSF TNGP12.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.showModa lDialog('Lookup _Cust.aspx' ,'Customer Lookup','dialog Height:
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.c om> wrote in message
news:e8******** *****@TK2MSFTNG P15.phx.gbl...
change the onclick routine to "window.close;r eturn false;"

-- bruce (sqlwork.com)
"John" <a@b.com> wrote in message
news:uh******** ********@TK2MSF TNGP12.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.returnVa lue 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******** ********@TK2MSF TNGP12.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
5134
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 hand edge of the window (i.e. Horizontal rules, 100% tables) fall short by around 15 - 20 pixels or so. I'm currently using internet explorer 6 and have created two simple pages to demonstrate the behavior. My original pages were much more complicated...
2
16145
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 showModalDialog. It is modal as far as the client is concerned but not the server... In my app I have a datagrid on the main aspx page, I pop up a modal dialog to edit a record. On closing the modal dialog I'd like to refresh the
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 showModalDialog. I also want to receive a result back from the ShowModalDialog when it is closed. My problems are currently these: (1) If I call the showModalDialog using RegisterClientScriptBlock, then I have no way of receiving a return...
5
3577
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 form to display, etc. But I want to refresh the content of the form displayed in the dialog window without navigating away from the form. For example... the showdialog method opens up a record to be edited. After editing when the save(submit)...
3
3089
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 correct? I didn't think it would be document.showModalDialog. if(window.showModalDialog){ //do something } else {
1
3083
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), bound to a SQLDataSource. The first time otherpage.aspx is opened from default.aspx the databinding occurs and the page_load occurs on otherpage.aspx. When the user closes that modal form by clicking the close box ("X") at the top right corner of...
6
2620
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 setting the treenode navigateurl to javascript:Click('test')
0
9386
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10144
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9822
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7366
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5270
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5405
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3917
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 we have to send another system
3
3522
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2793
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.