window won't close...

  • Thread starter Thread starter EMW
  • Start date Start date
E

EMW

In my ASPX page I have the following code behind which is activated when the
user clicks on a linkbutton:

Dim sFeatures As String = Chr(34) +
"DiaglogHeigth:50px;DialogWidth:412px;center:yes;help:no;resizable:no;scroll
:no;status:no;" + Chr(34)
Page.Response.Write("<script language=" + Chr(34) + "Javascript" + Chr(34) +
">")
Page.Response.Write("showModelessDialog(" + Chr(34) + "popupphonedata.aspx"
+ Chr(34) + "," + Chr(34) + Chr(34) + "," + sFeatures + ")")
Page.Response.Write("</script>")

On the popupphonedata.aspx page I have a button that has this code:

Dim msg As String
msg = msg & "<Script Language='JavaScript'>"
msg = msg & "window.close();"
msg = msg & "</Script>"
Page.Response.Write(msg)

When I click on the button, the window is not closed.
I seems almost that it is closed and then re-opened because of the script in
the main page.
How can I remove/de-activate that script after it is executed?

rg,
Eric
 
Hi,
In the popupphonedata.aspx try replacing the code with this
Dim msg As String
msg = msg & "<Script Language='JavaScript'>"
msg = msg & "function CloseWindow(){"
msg = msg & "window.close();"
msg = msg & "return false;}"
msg = msg & "</Script>"
Page.RegisterClientScriptBlock("startUp", msg)
Button1.Attributes.Add("OnClick", "return CloseWindow()")
where Button1 is the button on clicking which you want to close the window.
 
Thanks, but now the main window is closing and the one that should be closed
is maximized.

I must be doing something wrong....

rg,
Eric
 
Which page did you put the JavaScript in? It will close the browser of the
one it runs in.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
Back
Top