Groups | Blog | Home
all groups > asp.net > june 2004 >

asp.net : window won't close...


EMW
6/13/2004 11:00:01 PM
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

srini
6/13/2004 11:49:01 PM
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.
--
The best
srini


[quoted text, click to view]
Kevin Spencer
6/14/2004 5:20:52 PM
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.

[quoted text, click to view]

EMW
6/14/2004 9:21:29 PM
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



"srini" <srini@discussions.microsoft.com> schreef in bericht
news:333BBBC0-ED03-462F-9E2D-30B4B90EDA28@microsoft.com...
[quoted text, click to view]

AddThis Social Bookmark Button