This is a migrated thread and some comments may be shown as answers.

Simple Highlight TreeView Question

1 Answer 94 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Shawn
Top achievements
Rank 1
Shawn asked on 10 Feb 2009, 06:46 PM
I notice than when I click the text of a node element that it highlights.  I am using checkboxes in my treeview so how do I highlight the text anytime the checkbox is selected for each node?

Also - how can I make a click of the text also check and uncheck the node so that as long as I click anywhere on that node it toggles its checked state?

1 Answer, 1 is accepted

Sort by
0
Accepted
Yana
Telerik team
answered on 12 Feb 2009, 02:14 PM
Hello Shawn,

When node is clicked, it is selected , so you can achieve the wanted functionilty by subscribing to OnClientNodeChecked and OnClientNodeClicked events:

<telerik:RadTreeView ID="RadTreeView1" runat="server" CheckBoxes="true" 
            OnClientNodeChecked="nodeChecked" 
            OnClientNodeClicked="nodeClicked"

and javascript functions:

<script type="text/javascript">  
    function nodeChecked(sender, args)  
    {  
        args.get_node().set_selected(args.get_node().get_checked());  
    }  
           
    function nodeClicked(sender, args)  
    {  
        args.get_node().set_checked(args.get_node().get_selected());  
    }  
</script> 


Kind regards,
Yana
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
TreeView
Asked by
Shawn
Top achievements
Rank 1
Answers by
Yana
Telerik team
Share this question
or