473,786 Members | 2,375 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Window Does not close

Hi:

I have a child window which is opened by parent using ShowModalDialog .
Child has a button called Add and its click handler at server tries to
close the window as below.

private void Button_Add_Clic k(object sender, System.EventArg s e)
{
string strscript = "<script
language=javasc ript>window.top .close();</script>";
if (!Page.IsStartu pScriptRegister ed("clientScrip t"))
Page.RegisterSt artupScript("cl ientScript",
strscript);
}

But unfortunately, child window does not get closed. Any guess is very
much appreciated.

Thanks in Advance,

Vijay K Kerji
Nov 19 '05 #1
2 1915
First, make sure the code is executed. Sometimes due to varies reasons such
as forgotten to add a <from runat="server"> tag will cause the button
non-functional.

Second, just be curious, why do you want to execute "window.top.clo se()"
instead of "window.clo se"?

Third, another curious question, why do you want a server-side button to
handle what is normally handled by client side button?

"Vijay Kerji" <vi*********@ya hoo.com> ???
news:30******** *************** ***@posting.goo gle.com ???...
Hi:

I have a child window which is opened by parent using ShowModalDialog .
Child has a button called Add and its click handler at server tries to
close the window as below.

private void Button_Add_Clic k(object sender, System.EventArg s e)
{
string strscript = "<script
language=javasc ript>window.top .close();</script>";
if (!Page.IsStartu pScriptRegister ed("clientScrip t"))
Page.RegisterSt artupScript("cl ientScript",
strscript);
}

But unfortunately, child window does not get closed. Any guess is very
much appreciated.

Thanks in Advance,

Vijay K Kerji

Nov 19 '05 #2
A word of causion,

Popup-blockers such as the one included for IE in XP SP2 or in Mozilla
Firefox might not allow a JavaScript to be run at the time of page load.

"Vijay Kerji" <vi*********@ya hoo.com> wrote in message
news:30******** *************** ***@posting.goo gle.com...
Hi:

I have a child window which is opened by parent using ShowModalDialog .
Child has a button called Add and its click handler at server tries to
close the window as below.

private void Button_Add_Clic k(object sender, System.EventArg s e)
{
string strscript = "<script
language=javasc ript>window.top .close();</script>";
if (!Page.IsStartu pScriptRegister ed("clientScrip t"))
Page.RegisterSt artupScript("cl ientScript",
strscript);
}

But unfortunately, child window does not get closed. Any guess is very
much appreciated.

Thanks in Advance,

Vijay K Kerji

Nov 19 '05 #3

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

Similar topics

1
7988
by: Vetrivel | last post by:
Application architecture : Develop interface between two existing systems, a. Enterprise CRM system b. Web based intranet system. Environment : Intranet Server : IIS and ASP. Script : VBScript and Javascript Client : 1. IE browser. 2. VBForm embedded with WebBrowser control (MS Internet
3
5185
by: J P Singh | last post by:
Hi Guys Wonder if someone can help me with this. I have a form where a user clicks a button which gives them a pop up windows to allow them to add the data. The user adds the data and click save. The pop window closes and refreshs the parent window to allow the entered data to be displayed. It was all working okay until couple of days back when it stopped.
14
7960
by: Nigel Mercier ® | last post by:
I'm just starting to learn JavaScript, so far I like it! I want to add some JS to my Ebay listings, to manually open a pop-up window. It works OK, but the JS gets rejected by Ebay. If I can't use JS in my listing, is there a way of using JS to resize a current window, and remove the toolbars etc, so it looks like a pop-up? --
7
3228
by: E Michael Brandt | last post by:
I have been lurking here for some time, and now would like to ask a question of you clever coders: My JustSo PictureWindow 3 Extension for Dreamweaver has stumbled in the face of the new Opera 8. Jspw3 opens a popup window (using varname=window.open(...)) but there are now two problems: 1) Opera8 interprets a top,left of 0,0 to be top left of the browser window rather than of the entire screen, unlike the other modern browsers I've...
4
34892
by: GrantS | last post by:
I am having a problem closing a popup window opened modally. When I try to close the window (when the user hits save button and the data has been processed), the Popup window opens as a full screen as a new window. The original window plus the Modally opened Pop remain in a separate window. What I want to do is close the popup and return to the original window with its view state maintained. The control use to fire the popup window...
1
11585
by: Earl Teigrob | last post by:
I did a ton of searching to try and find a simple solution to this issue and finally wrote my own, which I am sharing with everyone. In my searching, I did find a very complete and robust solution at http://weblogs.asp.net/asmith/archive/2003/09/15/27684.aspx but it was far more complex then I needed. (I got lost trying to figure it all out). Therefore, here goes my simple "web dialog box with parent event handler fireing" solution. ...
2
3023
by: Tom | last post by:
How is the best way to avoid validation when closing a window? For instance, I have a Windows Forms window which has a validation event for a text box. However, if one enters invalid data in then and then attempts to close the window (either via my custom 'Close' box or by clicking the close 'X' in the upper right window corner), the validation event still triggers and it tells the user that they have invalid data. Which of course means...
5
3094
by: lindanr | last post by:
In ASP.NET 2005 I have an onblur="window.close()" javascript event in the <body> tag. When I click on the window's scrollbar, the window closes. The same code works fine in ASP.NET 2003. Any ideas?
9
4657
by: Stan B | last post by:
I create a popup window by calling window.showModalDialog Popup window has Ok button with this code attached: === string Script = "<script language=JavaScript>" + "{" + "window.close();" + "}" + "</script>";
4
10318
by: Andre | last post by:
With Firefox 1.5+, I used the following code to close a window/tab: === <html><head> <script language="javascript" type="text/javascript"> function closeWindow() { window.open('','_parent',''); window.close(); } closeWindow(); </script></head><body></body></html>
0
10360
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
10163
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10108
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9960
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
7510
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
5397
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
5532
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4064
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
2
3668
muto222
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.