Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

Problem with closing popup Window

$
0
0

Could someone help.  I have a situation where I have a main page that has an 'Email' button on it.  When the user clicks the button I call the following javascript to open an email window.  Default.aspx -> Calls Mail.aspx -> Calls SelectUser.aspx.  What I'm trying to do is emulate how Outlook allows you to click the button next to the "TO" box in an email to select an ActiveDirectory user.   When the user clicks the "Email From" button from Default.aspx the window pops up that allows the user to select the To, CC, BCC, and Subject and then click send.  When the user clicks the "To" button, another popup opens that displays all our active directory users for selection.  Opening all the windows works great, but when I try closing the 2nd window "SelectUser.aspx" using  <button onclick="javascript:window.close();" type="button">Close</button> the SelectUser.aspx window closes and the 1st popup Mail.aspx opens another bigger popup of itself.  Now I have two Mail.aspx windows open.  Note:  I use PopUpModal() to open the Mail.aspx from Default.aspx and SelectUser.aspx from Mail.aspx.

On Default.aspx - This opens popup window Mail.aspx

 <asp:Button ID="btnEmailForm" runat="server" class="button" Text="Email Form" OnClick="btnEmailForm_Click"
                        OnClientClick="PopUpModal('Mail.aspx','580','230');" /> 

On Mail.aspx - This opens popup window SelectUser.aspx

<asp:Button ID="btnTo" runat="server" Text="To" Width="40px" class="button"
                       OnClientClick="PopUpModal('SelectUsers.aspx', '530', '370');"/>

function PopUpModal(URL, width, height) {
 
    var path = URL + "?date=" + (new Date()).getTime();
    var WinSettings = "center:yes;resizable:no;dialogHeight:" + height + "px;dialogWidth:" + width
                      + "px;scroll:no"
    var returnArg = window.showModalDialog(path, '', WinSettings);    
 
}

Could someone please tell me what am I doing wrong?

Thanks

Dave.


Viewing all articles
Browse latest Browse all 23244

Trending Articles