asp.net 模态对话框返回值 问题

来源:百度知道 编辑:UC知道 时间:2024/06/30 19:43:30
有两个页面A.aspx和B.aspx
B是通过A以模态对话框的形式打开
现在需要完成如下操作:
在B页面执行一些操作,关闭后马上把操作状态返回给A页面,
A页面根据操作状态执行任务。
各路高手怎么实现?
我用Session 或 JS(window.returnValue)加隐藏控件, 两种方法都无法实现!
一楼的方法我已经用过了,能返回值给A页面,但后台代码怎么得到这个返回值?

可以用层实现。

A页面有个层是隐藏的,内容为B页面样子。

使用B提供的功能的话可以让层可见,操作完以后在隐藏B层

A.aspx
<input type="button" id="motai" name="motai" value="弹出模态窗口" onclick="show();" />
<script type="text/javascript">
function show(){
var r=window.showModalDialog("B.aspx","dialogHeight:410px;dialogWidth:460px");
alert(r);
}
</script>
---------------------------------------------------------------------
B.aspx
<input type="button" id="btnReturn" value="返回‘A’到父窗口" onclick="returnToParents();" />
<script type="text/javascript">
function returnToParents()
{
window.returnValue="A";
window.close();
}
</script>

=.=!

你在A页面打开B页面的时候这样写
:window.showModalDialog("B.aspx",window,""); PS:这里一定要传