Can I set Node CheckState on Client Side

2 posts, 0 answers
  1. Ryan
    Ryan avatar
    3 posts
    Member since:
    Apr 2009

    Posted 13 Apr 2009 Link to this post

    Is it possible to set TreeNode CheckState in the client side. If yes how?

    It seems that only retrieving the value is documented. I have also set the class of the created span elements to change display but when it goes back to the server, the check state remains at unchecked.
  2. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 14 Apr 2009 Link to this post

    Hello Ryan,

    Once you have a client-side reference to a Node, you can call function set_checked() to check/uncheck the node.

    [ASPX]
     
    telerik:radtreeview id="RadTreeView1" runat="server" CheckBoxes="true" 
    <Nodes> 
    <telerik:RadTreeNode runat="server" Text="Root RadTreeNode1">  
    </telerik:RadTreeNode> 
       . . .  
    </Nodes> 
    </telerik:radtreeview> 

    [JavaScript]
     
    <script type="text/javascript">  
    function checkNode()  
    {  
        var tree = $find("<%= RadTreeView1.ClientID %>");  
        var checkNode = tree.findNodeByText("Root RadTreeNode1");  
        checkNode.set_checked(true);  
    }  
    </script> 

    Thanks,
    Princy.
Back to Top