从里面关闭iframe,后面跟着代码 [英] Closing Iframe from inside with code behind
本文介绍了从里面关闭iframe,后面跟着代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个asp.net页面说A有一个iframe,这个iframe用弹出扩展器打开页面B,页面B也有一个iframe并用popupextender打开C.
how我可以从C关闭iframe B吗?
Hi, i have a asp.net page say A which has a iframe and this iframe is opens page B with popup extender, page B also have a iframe and opens C with popupextender.
how can i close iframe B from C?
推荐答案
好吧,我得到了解决方案。
我做的很简单,我用过javascript从IFRAME中的控件读取值,将它们保存在隐藏文件中,然后从代码隐藏文件中获取,我从隐藏字段中获取它们并将它们设置为相对位置。
这是我用过的东西
Javascript:
well, I got the solution.
what I did is so much simple, I used javascript to read values from control inside the IFRAME, saved them in a hidden filed, then from code behind file, I get them from hidden field and set them to their relative place.
this is what I used
Javascript:
var IFrame = document.getElementById("IFrameIDHere");
var Values = "";
Values += IFrame.contentDocument.getElementById("control_1").value + ",";
Values += IFrame.contentDocument.getElementById("control_2").value + ",";
Values += IFrame.contentDocument.getElementById("control_3").value + ",";
.
.
.
.
Values += IFrame.contentDocument.getElementById("control_n").value + ",";
document.getElementById("HiddenFieldID").value = Value;
之后,我从代码隐藏文件中做到了这一点。 (C#)
after that, I did this from code behind file. (C#)
string[] Values = HiddenFieldID.Text.ToString().Split(',');
现在,我使用了这个数组的值并完成了我的任务..
now, I used values from this array and did my task..
这篇关于从里面关闭iframe,后面跟着代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文