473,320 Members | 1,990 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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_Click(object sender, System.EventArgs e)
{
string strscript = "<script
language=javascript>window.top.close();</script>";
if (!Page.IsStartupScriptRegistered("clientScript"))
Page.RegisterStartupScript("clientScript",
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 1896
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.close()"
instead of "window.close"?

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*********@yahoo.com> ???
news:30**************************@posting.google.c om ???...
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_Click(object sender, System.EventArgs e)
{
string strscript = "<script
language=javascript>window.top.close();</script>";
if (!Page.IsStartupScriptRegistered("clientScript"))
Page.RegisterStartupScript("clientScript",
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*********@yahoo.com> wrote in message
news:30**************************@posting.google.c om...
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_Click(object sender, System.EventArgs e)
{
string strscript = "<script
language=javascript>window.top.close();</script>";
if (!Page.IsStartupScriptRegistered("clientScript"))
Page.RegisterStartupScript("clientScript",
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
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 :...
3
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...
14
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...
7
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...
4
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...
1
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...
2
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...
5
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...
9
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();" +...
4
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','');...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.