开发者

Why new window is opening when Click submit button in popup?

Hi I Opening a popup like this:

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

In the popup, when I click this button a new window is openi开发者_Go百科ng (with the popup contain):

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

I try to close the current popup before this new window. But this new window is display. Could you help me, thank you!

EDIT

I've try to return false after the widow.close in popup, ok new window is not fired, but Onclick event not call.

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

have you a suggestion?


Put this:

<base target="_self"/>

in the page header.


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

Edit on opening parent window, set this class to your parent window, so that it will be like modalpopup behaviour

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

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


In the popup page, you need to call a javaScript function on the parent page that will close the popup page.

On parent page:

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

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

On 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 the javascript dynamically after you 'Save' your data on the server side.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜