日期:2014-05-20  浏览次数:20504 次

asp.net 一个页面嵌入iframe 如何与主页面传值
A页面嵌入一个iframe     B页面   .
在A页面中   如何给B页面中的服务器控件赋值.




------解决方案--------------------
url传过去啊
------解决方案--------------------
假设你的a中有按钮
<INPUT type= "button " value= "Button " onclick= "javascript:window.frames[ 'testFrm '].window.document.getElementById( 'txtName ').value= 'www.163.com '; "> </td>

a中的 frame 为 <iframe id= "testFrm " frameborder= "0 " height= "200 " width= "100% " marginheight= "0 " marginwidth= "0 "
scrolling= "no " src= "b.aspx "> </iframe>
b中有个 <INPUT id= "txtName " style= "Z-INDEX: 101; LEFT: 16px; POSITION: absolute; TOP: 16px " type= "text "> textbox控件
点击a中的按钮b中的textbox的值即为www.163.com
------解决方案--------------------
如b.aspx 中有控件 Button bt=new Button();
在a.aspx 中有iframe name=ifrm 可以写脚本 document.ifrm.all( 'bt ').value= 'hehe ' 就行了
------解决方案--------------------
ref:http://community.csdn.net/Expert/topic/4957/4957568.xml?temp=.2132379
------解决方案--------------------
能找到,要 b frame的 document.getElementById(服务器控件的clientID)
------解决方案--------------------
我的a和b页面都是服务端控件.

-------

服务器端控件生成html也就变成客户端空间了,只是在服务器上运行的时候多了一些处理。
如果你要在服务器端传值可以考虑session。
------解决方案--------------------
有什么找不到的
只要放到客户端 有ID输出 就可以找到。
------解决方案--------------------
应该应用url重定向来传值
------解决方案--------------------
一、使用Querystring
二、使用Session变量
三、使用Server.Transfer
------解决方案--------------------
用Javascript还是比较方便的