asp.net父窗口、子窗口


一:转向子窗口的几种方法

1.在数据控件中(如:GridView,Repeater)

1
<a  href="#" onclick="window.open('money.aspx?lowhouseid=<%# DataBinder.Eval(Container.DataItem, "lowhouseid") %>&difficultid=<%# DataBinder.Eval(Container.DataItem, "difficultid") %>','','width=600,height=400,left=350,top=400,scrollbars=0,staus=0,toolbar=0,location=0');">
<%# DataBinder.Eval(Container.DataItem, "money")%> </a>
2
<a  href="#" onclick="var obj = new Object();obj.name='51js';window.showModalDialog('area.aspx?lowhouseid=<%# DataBinder.Eval(Container.DataItem, "lowhouseid") %>&difficultid=<%# DataBinder.Eval(Container.DataItem, "difficultid") %>',obj,'dialogWidth=650px;dialogHeight=400px;scroll:no');">
<%# DataBinder.Eval(Container.DataItem, "area")%> </a>

2:在js代码中

3
  <script language="javascript">
function fjzl() {
window.open('HouseMap.aspx?house_id=<%=houseid() %>&buildingnum=<%=buildingnum() %>', '', 'width=1000,height=800,left=100,top=100,scrollbars=1,staus=1,toolbar=1,location=1');
}
</script>

3:在后台中

4
Response.Redirect("http://www.cnblogs.com/../Error.html");

二:关闭子窗口刷新父窗口

1.html中(注:若父窗口中不用window.open打开子窗口,则window.opener会报错)

1
<body MS_POSITIONING= "GridLayout "   language="javascript"   onunload= "return   window_onunload() "> 
</body>


<script language="javascript">
function window_onunload() {
window.opener.location.reload()
}
</script>

2.后台中

2
ScriptManager.RegisterStartupScript(this, typeof(string), "key", "window.close();window.opener.window.location.reload(true); ", true);









你可能感兴趣的:(asp.net)