Why does a new window open when I click the Submit button in the pop-up menu?

Hi, I am opening a popup:

function openPopup() {
   RetVal = window.showModalDialog("chooseProducts.aspx", "", "dialogHeight: 330px; dialogWidth: 450px;scroll:no");
}

In a popup, when I click this button, a new window opens (with a popup):

<asp:Button ID="btnSave" runat="server" Text="Save" OnClick="savingImpr" OnClientClick="window.close();"/> 

I am trying to close the current popup in front of this new window. But this new window is a display. Could you help me, thanks!

EDIT

I am trying to return false after widow.close in a popup window, ok the new window does not fire, but the Onclick event does not fire.

<asp:Button ID="btnSave" runat="server" Text="Save" OnClick="savingImpr" OnClientClick="window.close();return false;"/> 

Do you have any suggestions?

+3
source share
3 answers

Can you try window.open(...)?

Edit , modalpopup

 .Background
    {
        position: relative;
        width: 100%;
        height: 100%;
        filter: alpha(opacity=40);
    }

$get('dvMain').className = 'Background';

+1

:

<base target="_self"/>

.

+3

On the popup page, you need to call the javaScript function on the parent page, which will close the popup.

On the parent page:

function openPopup() {
   RetVal = window.showModalDialog("chooseProducts.aspx", "", "dialogHeight: 330px; dialogWidth: 450px;scroll:no");
}

function closePopup() {
    //find and close your window here
}

On the popup page:

<asp:Button ID="btnSave" runat="server" Text="Save" OnClick="savingImpr" OnClientClick="window.parent.closePopup();"/>

Edit: instead of calling window.parent.closePopup onClientClick, you should add javascript dynamically after you save your data on the server side.

0
source

Source: https://habr.com/ru/post/1752062/


All Articles