Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
100
igtree_getTreeById not working with javascript
posted

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; }

Parents
No Data
Reply
  • 28464
    posted

    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>

Children