closing a popup form

S

SteveS

Hello. This is a strange problem which does not make sense to me.

I open a popup page with the following javascript code:

function OpenDenyWindow(changeId) {
retVal=window.showModalDialog('DenialEmailForm.aspx?id=1234'',
'dialogWidth:650px; dialogHeight:700px; resizable:no;');
//alert("Return val = " + retVal)
}


The screen opens fine. However, I can't get it to close after I the user
submits the form. I run this code in my click event:

Response.Write("<script language='javascript'>window.close();</script>")
OR
Page.RegisterStartupScript("AutoClose", "<script language
=""javascript"">window.close();</script" & ">")



Both of these statements do not work.

The problem gets more interesting. If I don't try to close the form, then a
duplicate popup form appears. Now, I have 2 popup forms!

Make sense?

This has me bewildered! Any ideas what is going on?

Thank you for your help!!

SteveS
 
Z

Zoe Brown

SteveS said:
Hello. This is a strange problem which does not make sense to me.

I open a popup page with the following javascript code:

function OpenDenyWindow(changeId) {
retVal=window.showModalDialog('DenialEmailForm.aspx?id=1234'',
'dialogWidth:650px; dialogHeight:700px; resizable:no;');
//alert("Return val = " + retVal)
}


The screen opens fine. However, I can't get it to close after I the user
submits the form. I run this code in my click event:

Response.Write("<script language='javascript'>window.close();</script>")
OR
Page.RegisterStartupScript("AutoClose", "<script language
=""javascript"">window.close();</script" & ">")



Both of these statements do not work.

The problem gets more interesting. If I don't try to close the form, then a
duplicate popup form appears. Now, I have 2 popup forms!

Make sense?

This has me bewildered! Any ideas what is going on?

Thank you for your help!!

SteveS
where is the form submitted ? if it is submitted to itself you are probably
seeing is close and then re-open again !
 
S

SteveS

The popup form is submitted to itself through this button:

<asp:Button ID="btnSend" Runat="server" Text="Send Denial"></asp:Button>

Then, the click event in the code-behind sends the javascript to the page:

Private Sub btnSend_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnSend.Click
...do stuff....
CloseWindow()
End Sub

Private Sub CloseWindow()
'Response.Write("<script
language='javascript'>window.close();</script>")
Page.RegisterStartupScript("AutoClose", "<script language
=""javascript"">window.parent.close();window.close();</script" & ">")
End Sub



So, do you think when a button is clicked on the popup form, it create
another browser window? How can I get around this?
 
V

Vidar Petursson

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top