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>
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;}
Attribute added to treeview at pageload :
treeView1.Attributes.Add("SelectedNodeChanged","return setFrameUrl('" +treeView1.ClientID + "')");
my problem the <iframe> not changing with a selection!
what is the best way to do it?