父页面:
String url = "../Public/xxxx.aspx?";
StringBuilder script = new StringBuilder();
script.Append("<script language=javascript>window.showModalDialog('");
script.Append(url);
script.Append("'+'&tempRandom='+Math.random()");
script.Append(",[document.getElementById('" + this.hdnIsOpen.ClientID + "')"); //回写值1,hdnIsOpen是server 端控件
script.Append(",document.getElementById('" + this.hdnBu.ClientID + "')"); //回写值2
script.Append(",document.getElementById('" + this.hdnOu.ClientID + "')]"); //回写值3
script.Append(",'dialogHeight:500px;dialogWidth:900px');");
script.Append("</script>");
Page.RegisterStartupScript("ShowBuOu", script.ToString());
弹出模态对话框页面:点确认回写值,关闭
StringBuilder sb = new StringBuilder();
sb.Append("<script language=javascript>");
sb.Append("dialogArguments[0].value='N';"); // dialogArguments[0]这是传过来的参数hdnIsOpen,可以对它做作
sb.Append("dialogArguments[1].value='" + bu + "';");
sb.Append("dialogArguments[2].value='" + ou + "';");
sb.Append("window.close();");
sb.Append("</script>");
this.ClientScript.RegisterStartupScript(this.GetType(), "Show", sb.ToString());