在页面加载时,我打开条款和条件的弹出窗口。一旦用户点击条款和条件弹出窗口的接受按钮,我需要在按钮点击后执行一些数据库操作一旦操作完成我需要关闭弹出窗口并显示父窗口并在父窗口上我需要通过DB返回值
$(document).ready(function () {
$.customDialogPopUp('Terms & Condition', '../Requisitions/TermsCondition.aspx', 95, 512);
});
这是打开弹出窗口。在按钮上单击弹出窗口
protected void btnApproved_Click(object sender, EventArgs e)
{
try
{
// DB Operation...
// var ReqId = DB return val
//ClientScript.RegisterClientScriptBlock(this.GetType(), "ClosePopup", "<script>CloseDialog1(); window.location.href =" + "../Requisitions/NewRequisition.aspx?ReqID="ReqId + ";</script>", true);
}
catch (Exception ex)
{
}
}
我正在尝试使用try block的第3行。
答案 0 :(得分:0)
做了几乎相同的事情,但猜测这是一个有点愚蠢的方法 在父页面中,在javascript部分中添加以下内容。
function refreshByBtn() {
document.getElementById('<%= btnApproved.ClientID %>').click();
}
在子页面中,也添加到javascript 猜你可以修改下面的代码。
window.onunload = refreshParent;
function refreshParent(){
self.opener.refreshByBtn();
}
当close close会触发btnApproved_click()然后回发父页面时。