使用TreeView填充iframe src(asp.net,javascript) [英] populate iframe src using TreeView (asp.net, javascript)

查看:93
本文介绍了使用TreeView填充iframe src(asp.net,javascript)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的页面包含:
1-一个从数据库中获取数据的asp:treeview节点(item_Name,item_Id).
2- iframe,带有指向带有参数
的外部页面的链接 用户应选择一个项目(树节点),以根据选定的节点值(item_id)动态填充iframe源(src).
iframe:

My page contains:
1- An asp:treeview nodes (item_Name,item_Id) getting data from database.
2- iframe with a link to an external page with a parameter
The user should select an item (tree node) to populate the iframe source(src) dynamically according to the selected node value (item_id).
the iframe:

<iframe id="myFrame"  runat="server" 

frameborder="0" marginwidth="0" marginheight="0" border="0" src="http://www.mynextwebsite.com/default.aspx" scrolling="yes"  ></iframe>


我创建了javascript函数来更改iframe src链接.如下:
setframe()脚本:


I created javascript function to change the iframe src link .. as follows:
setframe() script:

function setFrameUrl(id){
newUrl = 'http://www.mynextwebsite.com/default.aspx?mykey='+ id 
document.getElementById('myFrame').src = newUrl;}


在页面加载时将属性添加到treeview:


Attribute added to treeview at pageload :

treeView1.Attributes.Add("SelectedNodeChanged","return setFrameUrl('" +treeView1.ClientID + "')");



我的问题< iframe>不随选择而改变!


my problem the <iframe> not changing with a selection!
what is the best way to do it?

推荐答案

我认为您正在混淆dom元素事件和.net事件. SelectedNodeChanged是一个asp.net服务器端事件,您可以在回发期间进行处理.

看一下这篇文章: ASP.NET TreeView Control&客户浏览器 [
I think you''re confusing dom element events and .net events. SelectedNodeChanged is an asp.net server side event that you can handle when during a postback.

Have a look at this article: ASP.NET TreeView Control & the Client''s Browser[^]


这篇关于使用TreeView填充iframe src(asp.net,javascript)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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