I am using asp.net 2.0 , I have added a infra webtree with id trvRelationinfra but unable to access it with igtree_getTreeById, do I need to include any Javascript file related to Infragiostics controls? Following is the Javascript function, I think the problem is at 1st line with igtree_getTreeById, as -- alert("tree"); // gives message as "undefined"
function fn_getDetails() {
var tree = igtree_getTreeById("trvRelationinfra");
alert("tree"); // gives message as "undefined"
var node = tree.getNodeById("NodeID1");
var strID= node.DataKey;
alert(strID);
return false; }
Yes, I think I can, I just have one question... I will ask in the other forum thread, please keep the discussions there - we do not want to steal other people's threads / topics.
hey i have one problem with treeview will yo please help me..
check this, http://forums.infragistics.com/forums/t/4974.aspx
As Darell said, most probably your treeview client (javascript) ID is different from the server-side "trvRelationinfra" ID. This is controlled by the framework (INamingContainer) and we cannot change that.
There a couple of approaches:
1. You can use directly the ClientID of the treeview using the following syntax:
var tree = igtree_getTreeById("<%= trvRelationinfra.ClientID %> ");
or
2. Use the client-side InitializeTree event to get an instance of the tree based on the client id and then use from this point thereafter:
<ignav:UltraWebTree ID="UltraWebTree1" runat="server" Editable="true"> <ClientSideEvents InitializeTree="initTree" /> ... </ignav:UltraWebTree> <script language="javascript"> var tree; function initTree(treeId) { tree = igtree_getTreeById(treeId); } </script>
you pass two parameter to the function ,
like function fn_getDetails(treeId,nodeId)
and use,
var tree = igtree_getTreeById(treeId);
and dont display alert message alert("tree") like yhis ,instead display alert(tree).
All the files that would be needed would already be on the client.
My guess is that the client ID isn't "trvRelationinfra" but rather has something appended on it by a naming container.
But if that is the javascript you are using, you migt need to change the alert to do
alert(tree) // without quotation marks.
alert("tree") // should output 'tree' to the screen