首页 > 代码库 > C#--父子页面传值、刷新(showModalDialog)

C#--父子页面传值、刷新(showModalDialog)

父页面:

1 var obj = new Object(); 2 obj.name="name"; 3 var rtnValue=http://www.mamicode.com/window.showModalDialog("child.aspx",obj,"dialogWidth:500px;dialogHeight:300px;status:no;scrollbars=yes;help:no");4 if(rtnValue=http://www.mamicode.com/="ok"){5     window.location.reload();//刷新父页面6 }

子页面(两种方式):

1 ①前台(.aspx):2 <script type="text/javascript">3     var obj = window.dialogArguments;//获取父页面传值(alert("您传递的参数为:" + obj.name))4     window.returnValue=http://www.mamicode.com/"ok";//向父页面传值5     close();//关闭子页面6 </script>7 ②后台(.aspx.cs):8 Response.Write("<script type=‘text/javascript‘>window.returnValue=http://www.mamicode.com/‘ok‘;close();</script>");

 

C#--父子页面传值、刷新(showModalDialog)