Maintain Expanded State of TreeNode

2 posts, 1 answers
  1. Robert
    Robert  avatar
    68 posts
    Member since:
    Feb 2009

    Posted 24 Oct 2011 Link to this post

    I'm working with the Telerik RadTreeView;

    One objective for the functionality of the RadTreeView is to allow a User to either click the plus (+) sign (next to Node Name), or click the actual Node Name, and expand the Node;

    <telerik:RadTreeView ID="RadTreeView1" runat="server"  
             OnNodeExpand="RadTreeView1_NodeExpand" ForeColor="Black" 
                Font-Names="Microsoft Sans Serif" 
                onnodeclick="RadTreeView1_NodeClick" Height="600px" Width="300px" 
                        Font-Size="Medium" OnClientNodeClicked="ClientNodeClicked">

    <script type="text/javascript" language="javascript">
        function ClientNodeClicked(sender, eventArgs) {
            var node = eventArgs.get_node();
            //alert("You clicked " + node.get_text());
            if (node) {

    The above code works briefly, and expands a selected RadTreeView Node for a split second; However, because the RadTreeView is being built dynamically in the C# code-behind, a post back occurs, and the expanded node quickly returns to an un-expanded state;

    Thanks in advance for any insight;  Best regards - Rob
  2. Answer
    Plamen avatar
    2816 posts

    Posted 25 Oct 2011 Link to this post

    Hello Robert ,

    Here is a sample project that is showing a similar functionality as in the Load on Demand demo and works as expected on click.

    All the best,
    Plamen Zdravkov
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now
Back to Top