刷新父窗口后,弹出窗口再次重新加载 [英] Popup window reloads again after refreshing parent window

查看:123
本文介绍了刷新父窗口后,弹出窗口再次重新加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

刷新父窗口时出现问题.

我有一个Web表单,并且正在此表单上使用ViewState.在viewstate的第三个activeform上,我有一张桌子.在该表的一行中,当单选按钮的值等于No时(我在这里进行自动回发),将弹出一个窗口.在弹出窗口中,我使用户可以选择复选框列表中的某些项目,并将数据携带到父窗体的文本框中.直到这里一切都很好.

我的问题是我无法关闭弹出窗口.发生什么事;

我可以成功地将数据传递到父窗口,刷新它,但弹出窗口关闭,然后再次弹出.

我正在尝试使用此代码;

I am having a problem while refreshing my parent window.

I have a webform and I am using a viewstate on this form. on the viewstate''s 3rd activeform I have a table. In a row of this table when the radiobutton''s value is equal to No(I am doing an autopostback here) a popup window opens. Here on the popup window I make user to select some items in the checkbox list and carry the data to a textbox in the parent form. Till here everything is fine.

My problem is I can not close the popup. What happens is;

I can successfully pass the data to my parent window, refresh it but the popup windows closes and it popups again.

I am trying to do it with this code;

Page.RegisterStartupScript("CLOSE", "<script language="''javascript''">window.opener.document.forms(0).submit();self.close();</script>");


我也尝试过的;


What I also tried;

ClientScript.RegisterStartupScript(typeof(Page), "closePage", "window.onunload = CloseWindow();");





Page.RegisterStartupScript("CLOSE", "<script language="''javascript''">window.opener.location.reload();self.close();</script>");





Page.RegisterStartupScript("CLOSE", "<script language="''javascript''">window.opener.location.href = window.opener.location.href;self.close();</script>");





Page.RegisterStartupScript("CLOSE", "<script language="''javascript''">window.opener.history.go(0) = window.opener.location.href;self.close()</script>");

这三个不能按我想要的方式工作.他们要么再次弹出弹出窗口,要么关闭弹出窗口,重新加载父级,然后父级返回Viewstate的活动viewindex 1,而不是停留在3中.

有什么主意我该如何解决?谢谢

These three doesnt work the way I want. They either popup the popup window again, or close the popup, reload the parent but then parent goes back to Viewstate''s active viewindex 1 instead of staying in 3.

Any ideas how can I fix this? Thanks

推荐答案

parent返回到Viewstate的活动viewindex 1而不是停留在3.=您必须在每个帖子上设置活动视图(ActiveIndex) .

如果您在页面加载中注册脚本,则无论在哪个视图中,脚本都会在每次回发时执行.使用页面的IsPostback属性和必要条件来执行启动脚本.
parent goes back to Viewstate''s active viewindex 1 instead of staying in 3.= You have to set the active view (ActiveIndex) on each post back.

If you register the script on the page load it will execute on each time postback regardless which view. Use the IsPostback property of the page and necessary conditions to execute the startup script.


这篇关于刷新父窗口后,弹出窗口再次重新加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆