RadTreeNode attribute changes not persisted to server

2 posts, 0 answers
  1. Shane
    Shane avatar
    1 posts
    Member since:
    Jul 2007

    Posted 30 Jun 2009 Link to this post

    On the client, I'm perfoming the following treenode attribute update:
    1 function onNodeClicking(sender, args) { 
    2     var treeNode = args.get_node(); 
    3     var attribs = treeNode.get_attributes(); 
    4     attribs.setAttribute("test""54321"); 
    5  
    6     attribs2 = treeNode.get_attributes(); 
    7     alert(attribs2.getAttribute("test")); 
    8

    After the PostBack, the treenode's "test" attribute hasn't been updated and the original is rendered in the TextBox.
    1 protected void Page_Load(object sender, EventArgs e)  
    2     {  
    3         if (!IsPostBack) {  
    4   
    5             RadTreeView1.Nodes.Add(new Telerik.Web.UI.RadTreeNode("Node1"));              
    6             RadTreeView1.Nodes.Add(new Telerik.Web.UI.RadTreeNode("Node2"));              
    7             RadTreeView1.Nodes.Add(new Telerik.Web.UI.RadTreeNode("Node3"));  
    8               
    9             RadTreeView1.Nodes[0].Attributes.Add("test""1234");  
    10             RadTreeView1.Nodes[1].Attributes.Add("test""1234");  
    11             RadTreeView1.Nodes[2].Attributes.Add("test""1234");  
    12         }  
    13     }  
    14     protected void RadTreeView1_NodeClick(object sender, Telerik.Web.UI.RadTreeNodeEventArgs e) {  
    15         TextBox1.Text = e.Node.Attributes["test"];  
    16     }  

    I would assume this is a fairly common task and I'm just overlooking something.

    Any help is appreciated!

    telerik control is version 2009.1.402.35
  2. Atanas Korchev
    Admin
    Atanas Korchev avatar
    8462 posts

    Posted 01 Jul 2009 Link to this post

    Hello Shane,

    You need to call two more methods in order to persist client-changes to the server:

    sender.trackChanges();

    attribs.setAttribute("test","123123");

    sender.commitChanges();

    Best wishes,
    Albert
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top