How to get value of DataFieldParentID

2 posts, 0 answers
  1. Sanjoy
    Sanjoy avatar
    1 posts
    Member since:
    Jun 2012

    Posted 15 Jun 2012 Link to this post

    Hi,
    I am using Treeview with combobox.
    When we select any child node from hierarchy then how we will get "DataFieldParentID" value, Using Javascript and serverside programming. Please help me. It is urgent in our project requirement.

    Thanks and Regards,
    Sanjoy
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 15 Jun 2012 Link to this post

    Hello Sanjoy,

    Try the following code to achieve your scenario.
    1) From server side:
    C#:
    protected void RadTreeView1_NodeClick(object sender, Telerik.Web.UI.RadTreeNodeEventArgs e)
    {
      if (e.Node.ParentNode != null)
      {
        string value = e.Node.ParentNode.Value.ToString();
      }
    }

    2) From client side:
    JS:
    function OnClientNodeClicked(sender, args)
    {
     if (args.get_node().get_level() != 0)
     {
        alert(args.get_node().get_parent().get_value());
      }
    }

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top