我有一个应用程序,用户单击父窗口上的按钮即可显示弹出窗口。当用户关闭弹出窗口时,如何确定(在父窗口代码隐藏中)用户已关闭弹出窗口?
这是关闭弹出窗口的代码:
<script language="javascript" type="text/javascript">
function closeWin() {
GetRadWindow().Close();
}
</script>
<asp:Button ID="btnClose" runat="server" Text="Close"
OnClientClick="closeWin();return false;" onclick="btnClose_Click"/>
最佳答案
RadWindowManager 和 RadWindow 都有 onClientClose 事件。
一旦 RadWindow 关闭,OnClientClose
将被调用。然后您可以通过 Ajax 或完整回发调用父页面的代码。
父页面
<telerik:RadWindowManager .... OnClientClose="clientClose">
</telerik:RadWindowManager>
OR
<telerik:RadWindow ... OnClientClose="clientClose">
</telerik:RadWindow>
<telerik:RadAjaxManager ... ID="RadAjaxManager1"
OnAjaxRequest="RadAjaxManager1_AjaxRequest">
</telerik:RadAjaxManager>
父页面内的脚本
function clientClose(oWnd, args) {
// Optional arguments passed from RadWidow
var arg = args.get_argument();
// Here the example for ajax post back using RadAjaxManager
$find("<%= RadAjaxManager1.ClientID %>").ajaxRequest(arg);
}
父页面代码隐藏
protected void RadAjaxManager1_AjaxRequest(object sender, AjaxRequestEventArgs e)
{
// Argument passed by child window. It is an optional.
if (e.Argument == "xxx")
{
// Do something
}
}
更新:从子窗口收集返回参数
<script language="javascript" type="text/javascript">
function closeWin(arg) {
GetRadWindow().Close(arg);
}
</script>
<asp:Button ID="btnClose" runat="server" Text="Close"
OnClientClick="closeWin('something');return false;" onclick="btnClose_Click"/>
关于asp.net - 如何在父级中确定弹出的 radWindow 是否已关闭?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16065252/