I have a custom user control (ascx) with an ASP.NET treeview inside. I am attempting to retrieve the value from another ascx control on the same page using the following method.
var treeViewData = window["<%=TreeView1.ClientID%>" + "_Data"];
if (treeViewData.selectedNodeID.value != "") {
var selectedNode = document.getElementById(treeViewData.selectedNodeID.value);
var value = selectedNode.href.substring(selectedNode.href.indexOf(",") + 3, selectedNode.href.length - 2);
var text = selectedNode.innerHTML;
alert("Text: " + text + "\r\n" + "Value: " + value);
} else {
alert("No node selected.")
}
However, it is unable to locate TreeView1 because it resides in a different ascx control. Any suggestions on how to accomplish this?