简体   繁体   English

在弹出窗口关闭时刷新页面

[英]Refresh the page on close of popup window

How can I refresh the parent page on close of popup window. 如何在弹出窗口关闭时刷新父页面。 The close function is a RadCodeBlock client script. 关闭功能是RadCodeBlock客户端脚本。 How can I refresh the parent page from the given close function? 如何从给定的关闭功能刷新父页面?

<telerik:RadCodeBlock runat="server" ID="rcb1">
    <script type="text/javascript">
        function GetRadWindow() {
            var oWindow = null;
            if (window.radWindow)
                oWindow = window.radWindow;
            else if (window.frameElement.radWindow)
                oWindow = window.frameElement.radWindow;
            return oWindow;
        }

        function Close() {
            var result = window.confirm("Are you sure you want to close the window!");
            if (result == true) {
                var oWindow = GetRadWindow();
                oWindow.argument = null;
                oWindow.close();
                return false;
            } 
        }
    </script>
</telerik:RadCodeBlock>

Here's a working example from one of my old projects. 这是我的一个旧项目中的一个工作示例。 Perhaps it may give you some ideas. 也许它可以给您一些想法。

ASPX ASPX

<telerik:RadWindowManager ID="rwm" runat="server" VisibleStatusbar="false" ReloadOnShow="true">
   <Windows>
       <telerik:RadWindow ID="rw1" Title="My Window" runat="server" Behaviors="Default" OnClientClose="onClientClose">
       </telerik:RadWindow>
   </Windows>
</telerik:RadWindowManager>

JS JS

function OnClientClose(oWnd) {
     // alert("hello there");
     // you could use the client-side code to rebind the radgrid
     // e.g. 
     // var mt = $find("<%= RadGrid1.ClientID %>").get_masterTableView();
     // mt.rebind();
     // or you can just reload the page
     document.location.reload();
}

Alternatively, if you want to rebind or do some other things in the code behind, what you can do is to add a hidden button server control on the page, and then initiate the click event via your JS. 另外,如果您想重新绑定或在后面的代码中执行其他操作,则可以在页面上添加隐藏的按钮服务器控件,然后通过JS启动click事件。

Hope this helps. 希望这可以帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM