【问题标题】:How do I close a popup window on a press of a button and initiate postback on the window opening the popup?如何在按下按钮时关闭弹出窗口并在打开弹出窗口的窗口上启动回发?
【发布时间】:2009-03-12 16:58:11
【问题描述】:

见上文...

【问题讨论】:

    标签: c# asp.net javascript


    【解决方案1】:

    你应该可以调用 window.parent 中的函数。

    <script type="text/javascript">
        function closeThisPopupWindow()
        {
            if (window.parent && window.parent.callBack)
                window.parent.callBack();
            window.close();
        }
    </script>
    

    显然您需要将 closeThisPopupWindow 函数附加到您的按钮。

    【讨论】:

      【解决方案2】:

      我会在弹出窗口的按钮点击中做类似的事情

      ClientScript.RegisterStartupScript(typeof(string), "auto_refreshparent", @" window.opener.location.reload(); ", true);
      ClientScript.RegisterStartupScript(typeof(Page), "ThatsAllFolks", "window.close();", true);
      

      【讨论】:

        【解决方案3】:

        试试这样的:

        parent.document.getElementById('btnSubmit').click();; // submit the parent form
        self.close(); // close the current window
        

        【讨论】:

          【解决方案4】:

          string windowArgs = "toolbar=no,menubar=no,location=no,width=620,height=500,scrollbars=yes,resizable=yes,modal=yes"; 字符串 newWindowUrl = "MarketShotPreview.aspx"; 字符串 javaScript = "\n" + "\n" + "\n"; ClientScript.RegisterStartupScript(typeof(System.Web.UI.Page), "Popup", javaScript);

          【讨论】:

            猜你喜欢
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 2012-06-03
            • 2018-04-03
            • 2014-10-17
            相关资源
            最近更新 更多