如何在不刷新父页面的情况下从弹出窗口传递值到父页面? [英] How to pass values to Parent page from pop up without refreshing the parent page?

查看:61
本文介绍了如何在不刷新父页面的情况下从弹出窗口传递值到父页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我必须使用ASPX页面A.aspx和B.Aspx。 A.aspx具有邮件发送功能[To,Cc,Subject和SendButton] To和CC是超链接,我们还有To和CC文本框,链接将打开一个弹出窗口,其中包含带有radgrid中加载的复选框的电子邮件ID。我正在尝试从弹出窗口[B.aspx]后面的代码中将选定的mailids发送到A.aspx页面文本框。

我正在使用Page.ClientScript.RegisterStartupScript来调用弹出窗口的javascript,而后者又设置了A.aspx的值。但是它没有工作。所以请告诉我哪个是实现这个的最好方法。



谢谢

Hi guys,

I have to ASPX pages A.aspx and B.Aspx. A.aspx has mail sending functionality [To,Cc,Subject and SendButton] To and CC are hyperlinks and also we have To and CC textboxes, the links will open a popup which has email ids with checkboxes loaded in radgrid. I'm trying to send the selected mailids to A.aspx page textbox from code behind of popup[B.aspx].
I'm using Page.ClientScript.RegisterStartupScript to call javascript of popup which in turn sets the value of A.aspx.But its not working.So please tell me which is the best way to achieve this.

Thanks

推荐答案

首先,打开弹出窗口很少是一个好习惯。这本身并不坏,但许多用户试图与恼人的弹出广告作斗争,并会使用为此目的开发的一些流行的浏览器插件阻止弹出窗口。



但你的问题是非常可以解决。事情是:一个弹出窗口,它的父母不是独立的;弹出窗口会记住它的父级,并可以在Javascript中操作它。解决方案的关键是:

http://www.w3schools.com/jsref/ prop_win_opener.asp [ ^ ]。



上面引用的页面上的简单示例显示了如何使用它。







另外,你可以使用 window.parent http://www.w3schools.com/jsref/prop_win_parent.asp [ ^ ]。



-SA
First of all, it's rarely a good practice to open a popup window. This is not inherently bad, but many users try to fight against annoying popup ads and will block popups using some popular browser plugin developed for such purposes.

But your problem is quite solvable. The thing is: a popup window and its parent are not independent; a popup window remembers it parent and can manipulate it in Javascript. The key to the solution is this:
http://www.w3schools.com/jsref/prop_win_opener.asp[^].

The simple sample on the page referenced above shows how can you use it.



Also, you can use window.parent: http://www.w3schools.com/jsref/prop_win_parent.asp[^].

—SA

这篇关于如何在不刷新父页面的情况下从弹出窗口传递值到父页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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