Tree view lost Attributes. ASP.Net

Posted by: daniel13 on 10 September 2017, 11:39 am EST

  • Posted 10 September 2017, 11:39 am EST


    I classify each node in the client side to avoid certain actions, such as "Drag & Drop."

    On the server side I assign to each node an attribute name and value, for example:

    treeNodeAux.Attributes.Add ("NyName", "MyValue");
    But the properties are lost in each postback.

    I can do to not be lost or other property of the class "C1TreeViewNode" I can use to see what type is my node.

    Daniel Alonso.
  • Replied 10 September 2017, 11:39 am EST

    Hi Daniel,

    You can set the Value property of the C1TreeViewNode and retrieve it's value on client side and perform/avoid certain actions.

    If you're adding the nodes at runtime, you can add the values using the following code:

    for (var i = 1; i <= 10; i++)
    node = new C1TreeViewNode();
    node.Text = "Node " + i;
    node.Value = "Node " + i;

    and retreive it's value on client side using:

    var nodeValue = node.get_value();

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels