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
840
Get all Nodes in javascript of webdatatree
posted

Hi,

 

Can anyone let me know how to get all the nodes in javascript when button click. 

i need the function to get all the node in button click  but get_checkedNodes will be in checked change event of tree view . how can i get the get the checked nodes in treeview without any treeview events.

i have been using the following code but it error is comming,

 

 var nodes = new Array;

 

            var tree = document.getElementById('ctl00_ContentPlaceHolder1_WebTab1_tmpl0_WebDataTree1');

 

            nodes = tree.get_checkedNodes();

 

            var CompGuid = "";

 

            for (var i = 0; i < nodes.length; i++) {

 

                if (nodes[i].get_checkState == 1) {

 

                    //if (CompGuid.length > 0) {

 

                        CompGuid += ",";

 

                    //}

 

                    CompGuid += nodes[i].value;

 

                }

 

            }

 

Thanks in Advance.

Parents
  • 49378
    posted

    Hi anilkoomar_1202,

    Thank you for posting in the community.

    In order to access the WebDataTree object on the client either $find or the ig_controls object can be used. For instance:

    var tree = $find('<%= WebDataTree2.ClientID %>');

    var tree = ig_controls.ContentPlaceHolder1_WebDataTree2;

    Please let me know if this helps.

Reply Children