我用window.showModalDialog() 打开一个A.aspx页面,A页面上嵌着几个iframe B.aspx,C.aspx,D.aspx,E.aspx 如下源码: <asp:Panel class="tagContent selectTag" style="height:auto;" id="tagContent0" runat="server" Width="100%">
<iframe id="mainFrame0" frameborder="0" height="600" name="mainFrame0" scrolling="no"
src="B.aspx?mode=<%=Request.QueryString["mode"] %>&id=<%=Request.QueryString["id"] %>&pid=<%=Request.QueryString["pid"] %>" width="100%"></iframe>
</asp:Panel>
<asp:Panel class="tagContent" id="tagContent1" style="height:auto;" runat="server" Width="100%">
<iframe id="mainFrame1" frameborder="0" height="600" name="mainFrame1" scrolling="auto"
src="C.aspx?mode=<%=Request.QueryString["mode"] %>&id=<%=Request.QueryString["id"] %>&from=fitting" width="100%"></iframe>
</asp:Panel>
<asp:Panel class="tagContent" id="tagContent2" style="height:auto;" runat="server" Width="100%">
<iframe id="mainFrame2" frameborder="0" height="600" name="mainFrame2" scrolling="auto"
src="D.aspx?mode=<%=Request.QueryString["mode"] %>&id=<%=Request.QueryString["id"] %>" width="100%"></iframe>
</asp:Panel>
<asp:Panel class="tagContent" id="tagContent3" style="height:auto;" runat="server" Width="100%">
<iframe id="mainFrame3" frameborder="0" height="600" name="mainFrame3" scrolling="auto"
src="E.aspx?mode=<%=Request.QueryString["mode"] %>&id=<%=Request.QueryString["id"] %>" width="100%"></iframe>
</asp:Panel>
我现在的问题是,我要在A.aspx里的第一个iframe里就是B.aspx的一个按钮事件要改变父页面A.aspx的参数,就是让A.aspx重新刷新,以便B.aspx,C.aspx,D.aspx,E.aspx重新获取参数我现在的代码是:string script = @";parent.location.href='/'+parent.location.pathname +'?mode=edit&id=" + this.F_PK_FITTING_ID.Text + "&pid=" + Request.Params.Get("pid") + "';";
this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", script, true);
这样有一个问题是它自己会打开一个新的窗口,我要的是还是在模态窗口里打开。请问各位有没有好的解决方案(: 解决后结帐备注:以前不用window.showModalDialog()打开时是正确的。
<iframe id="mainFrame0" frameborder="0" height="600" name="mainFrame0" scrolling="no"
src="B.aspx?mode=<%=Request.QueryString["mode"] %>&id=<%=Request.QueryString["id"] %>&pid=<%=Request.QueryString["pid"] %>" width="100%"></iframe>
</asp:Panel>
<asp:Panel class="tagContent" id="tagContent1" style="height:auto;" runat="server" Width="100%">
<iframe id="mainFrame1" frameborder="0" height="600" name="mainFrame1" scrolling="auto"
src="C.aspx?mode=<%=Request.QueryString["mode"] %>&id=<%=Request.QueryString["id"] %>&from=fitting" width="100%"></iframe>
</asp:Panel>
<asp:Panel class="tagContent" id="tagContent2" style="height:auto;" runat="server" Width="100%">
<iframe id="mainFrame2" frameborder="0" height="600" name="mainFrame2" scrolling="auto"
src="D.aspx?mode=<%=Request.QueryString["mode"] %>&id=<%=Request.QueryString["id"] %>" width="100%"></iframe>
</asp:Panel>
<asp:Panel class="tagContent" id="tagContent3" style="height:auto;" runat="server" Width="100%">
<iframe id="mainFrame3" frameborder="0" height="600" name="mainFrame3" scrolling="auto"
src="E.aspx?mode=<%=Request.QueryString["mode"] %>&id=<%=Request.QueryString["id"] %>" width="100%"></iframe>
</asp:Panel>
我现在的问题是,我要在A.aspx里的第一个iframe里就是B.aspx的一个按钮事件要改变父页面A.aspx的参数,就是让A.aspx重新刷新,以便B.aspx,C.aspx,D.aspx,E.aspx重新获取参数我现在的代码是:string script = @";parent.location.href='/'+parent.location.pathname +'?mode=edit&id=" + this.F_PK_FITTING_ID.Text + "&pid=" + Request.Params.Get("pid") + "';";
this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", script, true);
这样有一个问题是它自己会打开一个新的窗口,我要的是还是在模态窗口里打开。请问各位有没有好的解决方案(: 解决后结帐备注:以前不用window.showModalDialog()打开时是正确的。
showModalDialog 方法的第二个参数 ,可以用this 来把当前窗体对象传过去.
在被showModalDialog 打开的也就可以用showModalDialog 来获得前一窗体的引用了
window.dialogArguments 是得到用showModalDialog 的父页面,而不是我打开的的那个页面(:
更好的的办法是在客户端用脚本去改变各URL的参数,不要回服务器端处理
sorry~ 看差了 原来你要刷新showModalDialog 打开的页<head></head>中加上<base target="_self"> 不行么?
将以下内容添加到页面的<head></head>标签内,即可实现showModalDialog的页面刷新和IE"后退"按钮无效功能。 <meta http-equiv="Pragma" content="no-cache">
<!-- Pragma content set to no-cache tells the browser not to cache the page
This may or may not work in IE --> <meta http-equiv="expires" content="0">
<!-- Setting the page to expire at 0 means the page is immediately expired
Any vales less then one will set the page to expire some time in past and
not be cached. This may not work with Navigator -->
http://xiajx.spaces.live.com/blog/cns!11f54dd21fcd88ab!132.entry
B.aspx,C.aspx,D.aspx,E.aspx 什么的
<frame name="contents" target="main" src="left.aspx" marginwidth="1" marginheight="1" scrolling="yes">
<frame name="main" src="Op.aspx" scrolling="auto" >
</frameset>
例如框架是这样的 话。那你就在left这个页面加上
<head id="Head1" runat="server">
<base target="main" />main是右边的frame起得名字
</head>
就考虑在showModalDialog打开的页内加 iframe ,iframe 为目标页.刷新iframe
新建一个页面new.aspx,在new.aspx中放一个iframe,其src指为A.aspx
这样就不会再打开新的页面了。