Click here to Skip to main content
15,893,486 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am constructing a tree view nodes dynamically from server side.

I want to trigger a client side event for only two types of nodes
- Child node
- Parent node that has no child
I need to disable clicking the parent node that has child.

Expecting your suggestions/help asap

Thanks in advance
Posted

I want to trigger a client side event for only two types of nodes
- Child node
- Parent node that has no child

This simply means that you want to trigger an event for all the nodes that has no child.

Loop through all the nodes, see if they have a child. If not, attach the event. Did you try?
Alternatively, you can attach click event to all the nodes and disable only those nodes that has some child.

Try!
 
Share this answer
 
I found the solution to invoke client side event using jquery

JavaScript
$(document).ready(function() {
            $(".rootNode").live("click", function() {
                //do something
            });

            $(".childNode").live("click", function() {
               //do something
            });

            $(".rootwithoutchild").live("click", function() {
                //do something
            });
        });


I could not add event for the specific node in the server side while looping through as I don't find any option to add attributes for the Treenode. So I have tried using jquery and finally achieved.

Thanks for you help
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900