CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
可用分押宝游戏火热进行中... 专题改版:Java Web 专题
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  .NET技术 >  ASP.NET

弹出的页面是框架页面,如何关闭这个框架页面的时候,刷新原来的页面?

楼主ljb1981216(麻辣土司(天冷了,没钱买裤衩))2005-04-04 13:50:54 在 .NET技术 / ASP.NET 提问

弹出的页面是框架页面,包括top和bottom两个框架,在底部框架中,实现关闭页面  
  this.Page.RegisterStartupScript("ErrorInfo","<script>alert('活动处理成功!');top.opener=null;top.close();</script>");  
  我怎么能够实现关闭这个页面的时候,父页面重新刷新,或者重新指向父页面。  
  我在后边加上this.Response.Redirect("Actitydeal.aspx?activityId="   +   act_id   +"   &processId="   +proc_id);这句后,是在弹出页面中,重新定向了这个页面。 问题点数:40、回复次数:20Top

1 楼ljb1981216(麻辣土司(天冷了,没钱买裤衩))回复于 2005-04-04 14:47:18 得分 0

大家帮我看看啊;Top

2 楼zxjuana(宝宝粥)回复于 2005-04-04 14:57:10 得分 0

parent.reload()Top

3 楼athossmth(athos)回复于 2005-04-04 14:59:27 得分 0

不要用后面的redirect  
  前面不要top.opener=null;top.close()  
  直接用window.open(),然后把目标定在topTop

4 楼zxjuana(宝宝粥)回复于 2005-04-04 15:05:50 得分 0

 
  window.opener.location.reload();  
  window.close()Top

5 楼ljb1981216(麻辣土司(天冷了,没钱买裤衩))回复于 2005-04-04 15:12:51 得分 0

目标定在top?怎么写?Top

6 楼ljb1981216(麻辣土司(天冷了,没钱买裤衩))回复于 2005-04-04 15:20:36 得分 0

我这样写了,  
  this.Page.RegisterStartupScript("ErrorInfo","<script>alert('活动处理成功!');window.open('Actitydeal.aspx?activityId='   +   act_id   +'   &processId='   +proc_id);</script>");  
  可还是不行啊;Top

7 楼tophifi(黑字先生)回复于 2005-04-04 15:29:27 得分 0

Response.Write("<script   language=javascript>windows.close();parent.window.location.reload();</script>  
  Top

8 楼ljb1981216(麻辣土司(天冷了,没钱买裤衩))回复于 2005-04-04 16:20:25 得分 0

我的是框架页面,parent.window.location.reload();不行    
  效果是弹出的页面关闭一次,再重新弹出一次,我想关闭整个弹出页面,父页面刷新Top

9 楼tophifi(黑字先生)回复于 2005-04-04 16:30:02 得分 0

要页面A弹出页面B,然后页面B关闭后刷新页面A?  
   
  不会。。。Top

10 楼ljb1981216(麻辣土司(天冷了,没钱买裤衩))回复于 2005-04-04 16:47:54 得分 0

对,就是页面A弹出页面B,然后页面B关闭后刷新页面A,并且页面B是一个框架页面,  
  在框架页面中包括页面C和页面D,关闭页面B和刷新页面A的代码最好是写在这里边  
  的事件中。Top

11 楼zxjuana(宝宝粥)回复于 2005-04-04 17:28:13 得分 0

我试了一下,可以的  
  页面A里放了一个链接,点击打开新页面B。。B是框架页。。框架页的主要HTML代码如下:  
   
  <frameset   cols="201,*"   frameborder="NO"   border="0"   framespacing="0"   rows="*"   onUnload="opener.location.reload();">    
      <frame   name="leftFrame"   scrolling="NO"   noresize   src="left.htm">  
      <frame   name="mainFrame"   src="main.htm">  
  </frameset>  
  <noframes>    
  <body   bgcolor="#FFFFFF"   text="#000000">  
  </body>  
  </noframes>    
   
  当我点击A中的链接时,打开页面B。。关闭B时。A刷新了Top

12 楼syeerzy(快乐永远*先天下之乐而乐*后天下之忧而忧*)回复于 2005-04-04 17:41:54 得分 0

解决方法1  
  window.opener.location.reload();  
  window.close()  
   
  解决方法2  
  关闭前运行window.open("原窗口路径","原窗口的框架名(没有的话要起)")  
   
  Top

13 楼ljb1981216(麻辣土司(天冷了,没钱买裤衩))回复于 2005-04-05 08:57:37 得分 0

按宝宝粥的做法,还是不行,在页面A里边是,是利用window.open(),弹出的页面.Top

14 楼thinhunan(THIN[MVP_asp.net])回复于 2005-04-05 09:35:33 得分 0

你用showModelessDialog不就行了  
  var   x   =   showModelessDialog(......)//打开的页面自动关闭   
  window.location.reload();Top

15 楼ljb1981216(麻辣土司(天冷了,没钱买裤衩))回复于 2005-04-05 09:42:39 得分 0

linkbutton,我用的是open,如果我不用open,用redirect,我该怎么写?  
  e.Item.Cells[8].Attributes.Add("onclick","window.open('EntityDetails.aspx?actionState="+actionState+"&apply_id="+apply_id+"&unit_id="+unit_id+"&proc_id="+proc_id+"&act_id="+act_id+  
  "','newwin','height=650,width=700,   top=20,left=80,toolbar=no,menubar=no,   scrollbars=no,   resizable=no,location=no,   status=no');");    
  我这里边用到很多参数,不都是从数据集里取出来的Top

16 楼bingbingcha(不思不归,不孟不E,原来是头大灰狼)回复于 2005-04-05 10:23:33 得分 0

以下是我给你写的代码.实现了你要的效果,但是我没有使用Page.RegisterStartupScript,  
  因为打开页面frameset.aspx的是框架.所以你用window.opener刷新父页面会出错..  
   
  代码已经测试OK..  
   
  ======================***open.aspx页面**============================  
   
  <HTML>  
  <HEAD>  
  <title>open</title>  
  <meta   name="GENERATOR"   Content="Microsoft   Visual   Studio   .NET   7.1">  
  <meta   name="CODE_LANGUAGE"   Content="C#">  
  <meta   name="vs_defaultClientScript"   content="JavaScript">  
  <meta   name="vs_targetSchema"   content="http://schemas.microsoft.com/intellisense/ie5">  
  </HEAD>  
  <body   MS_POSITIONING="GridLayout">  
  <a   href="#"   onclick="javascript:var   winopen=window.open('frameset.aspx','news');">点击打开框架</a>  
  <form   id="Form1"   method="post"   runat="server">  
   
  <asp:TextBox   id="TextBox1"   style="Z-INDEX:   101;   LEFT:   360px;   POSITION:   absolute;   TOP:   200px"  
  runat="server"></asp:TextBox>  
  </form>  
  </body>  
  </HTML>  
   
  ======================***frameset.aspx页面**============================  
   
  <frameset   cols="201,*"   frameborder="NO"   border="0"   framespacing="0"   rows="*"   onUnload="opener.location.reload();">  
  <frame   name="leftFrame"   scrolling="NO"   noresize   src="left.htm">  
  <frame   name="mainFrame"   src="main.htm">  
  </frameset>  
  <noframes>  
  <body   bgcolor="#FFFFFF"   runat="server"   text="#000000">  
  </body>  
  </noframes>  
   
  ======================***main.htm页面**============================  
  <html>  
      <head>  
          <title>main</title>  
          <meta   name="GENERATOR"   Content="Microsoft   Visual   Studio   .NET   7.1">  
          <meta   name="CODE_LANGUAGE"   Content="C#">  
          <meta   name=vs_defaultClientScript   content="JavaScript">  
          <meta   name=vs_targetSchema   content="http://schemas.microsoft.com/intellisense/ie5">  
      </head>  
      <body   MS_POSITIONING="GridLayout">  
  <div   onclick="javascript:if(parent.opener!=null){parent.opener.location.href='open.aspx';parent.close()}">我是主页面</div>  
     
      </body>  
  </html>  
  Top

17 楼zxjuana(宝宝粥)回复于 2005-04-05 11:31:22 得分 0

怎么还不行,你现在的需求是不是这样:  
  页面A:有个按钮a,点击a打开页面B(用window.open())  
  页面B:是框架,包含页面C和页面D。D中有个按钮d,点击d关闭框架页面B,同时刷新页面A。。对不对?Top

18 楼zxjuana(宝宝粥)回复于 2005-04-05 11:40:36 得分 40

你现在哪里出的问题?是刷新时出现重试之类的吗?那就用window.opener.location.href=window.opener.location.href  
   
  下面我按上面的需求给出主要的一些功能代码:  
   
  页面A,按钮a的点击事件里添加如下代码:  
  private   void   a_Click(object   sender,   System.EventArgs   e)  
  {  
      Page.Response.Write("<script>window.open('B.aspx')</script>");  
  }  
   
  页面B:HTML代码:  
  <frameset   cols="201,*"   frameborder="NO"   border="0"   framespacing="0"   rows="*"   onunload="window.opener.location.href=window.opener.location.href">  
  <frame   name="TopFrame"   scrolling="no"   noresize   src="C.aspx">  
  <frame   name="BottnFrame"   src="D.aspx">  
  </frameset>  
   
  其中D页面,里有个按钮d,按钮d添加Click事件,代码如下:  
  private   void   d_Click(object   sender,   System.EventArgs   e)  
  {  
    Page.Response.Write("<script>window.parent.close();</script>");  
  }  
   
  我执行过了,点击A页中的按钮弹出B页面,当我点击B框架页中的D页面中的d按钮时,关闭B页面,并且同时刷新了A页面。  
   
  另外,如果你需要传递参数,可以使用SessionTop

19 楼ljb1981216(麻辣土司(天冷了,没钱买裤衩))回复于 2005-04-05 12:51:49 得分 0

谢谢你!Top

20 楼ljb1981216(麻辣土司(天冷了,没钱买裤衩))回复于 2005-04-05 13:05:43 得分 0

我的hotmail是ljb1981216@hotmail.com,如果愿意,请加我,谢谢你的帮助!Top

相关问题

  • 框架页面弹出的模态对话框刷新其父窗口
  • 问一个框架的问题,如何在框架的弹出窗口中刷新后面弹出它的框架页面
  • 如何在弹出窗口实现对背后框架中某一特定页面的自刷新
  • 框架页面中,怎么在左边页面中刷新右边的页面,既左边页面弹出消息框,点击了消息框后就刷新右边的页面??
  • 框架页面的刷新,请帮忙!!!
  • 框架页面的刷新问题?
  • 关于框架页面刷新
  • 求助框架页面刷新问题?
  • 请教:弹出页面,刷新父页面
  • 框架(frameset)页面中点按钮弹出新页面

关键词

  • 页面
  • 框架

得分解答快速导航

  • 帖主:ljb1981216
  • zxjuana

相关链接

  • CSDN .NET频道
  • .NET类图书
  • C#类图书
  • .NET类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
世纪乐知(北京)网络技术有限公司 版权所有, 京 ICP 证 020026 号
北京创新乐知广告有限公司 提供技术支持
Copyright © 2000-2007, CSDN.NET, All Rights Reserved
GongshangLogo