window.open 弹出页面回写父页面值及触发父页面Button事件
父页面前台open JS:
function changeBOM(GVNo,EmpNo,DataReceiver,ButtonReceiver)
{
//DataReceiver 需要通过弹出页面回写父页面控件的clientid.
//ButtonReceiver 需要通过弹出页面触发父页面Button控件的clientid.
window.open("../xxxx.aspx?GVNo="+GVNo+"&EmpNo="+EmpNo+"&DataReceiver=" + DataReceiver+"&ButtonReceiver="+ButtonReceiver,null,"resizable=yes,status=no,scrollbars=yes");
}
父页面后台:
Page.ClientScript.RegisterStartupScript(this.GetType(), "Open", "<script>changeBOM('" + this.wcFillerEmpInfoCtrl.GVNO + "','" + this.tbxApplicantEmpNo.Text + "','" + this.tbxImpactProduction.ClientID + "','" + this.btnRefresh.ClientID + "');</script>");
btnRefresh 需要有Click 事件
要成功触发父页面button 控件,这个控件的visiable 不能false.否则生成的html 中找不到这个控件。
要隐藏这个控件,可以设width = "0px".
弹出页面回写:
ClientScript.RegisterStartupScript(this.GetType(), "e", "<script language = javascript>window.opener.document.all." + Request["DataReceiver"].Trim() + ".value = '" + returnAssembly + "';window.opener.document.all." + Request["ButtonReceiver"].Trim() + ".click();</script>");