您的位置:首页 > 编程语言 > ASP

框架里的main.aspx利用showModalDialog打开子页面B,B页面点确定后关闭自己并局部刷新父页面main.aspx的方法

2010-09-06 10:23 441 查看
<frameset rows="60,*,20" cols="*" frameborder="NO" border="0" framespacing="0" id="frame1">
<frame name="top" scrolling="no" noresize src="top.aspx" frameborder="0">
<frameset rows="*" cols="170,*" frameborder="NO" border="0" framespacing="0" id="frame2">
<frame name="leftmenu" scrolling="auto" noresize src="left.aspx" frameborder="0">
<frame name="mainframe" scrolling="auto" noresize src="main.aspx" frameborder="0">
</frameset>
<frame name="bottom" scrolling="no" noresize src="bottom.aspx" frameborder="0">
</frameset>

框架里的main.aspx利用showModalDialog打开子页面B,B页面点确定后关闭自己并局部刷新父页面main.aspx的方法如下:
B页面确定事件件如下:
protected void Button1_Click(object sender, EventArgs e)
{
Response.Write("<script>window.returnValue=1;window.close();</script>");
Response.Write("<script>window.close();</script>");
}
1:在父页面main.aspx放一隐藏按钮<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="" width="0"/>
2:在父页面:
var returnValue=window.showModalDialog('writeWorkRecord.aspx' ,'','dialogWidth='+width+'px;dialogHeight='+

height+'px;resizable=no;help=no;center=yes;status=no;scroll=no;edge=sunken');
if (returnValue==1)
{
//window.location.reload(); //这个不好,因为是整个页面刷新
document.getElementById('Button1').click();
}
3:在父页面的CS里写事件:
protected void Button1_Click(object sender, EventArgs e)
{
bind(); //这句不能少,否则不能刷新
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: