窗体A打开了窗体ChildA,在ChildA中处理得到的数据,回传给窗体A时,可以参考如下做法。
窗体A的前台JavaScript方法
function SetReturnStr(returnArray)
{
document.getElementById("txt1").value = returnArray [0];
document.getElementById("txt2").value = returnArray [1];
document.getElementById("txt3").value = returnArray [2];
}
窗体ChildA的后台代码
ScriptManager.RegisterStartupScript(
this.Page,
this.GetType(),
"click",
"var myArray=new Array(6);myArray[0]='" + strEmpNo
+ "';myArray[1]='" + strA
+ "';myArray[2]='" + strB
+ "';myArray[3]='" + strC
+ "';myArray[4]='" + strD
+ "';myArray[5]='" + strE
+"';if(!opener.closed){opener.SetReturStr(myArray);}window.close();",
true
);