This is a migrated thread and some comments may be shown as answers.

How to get value of DataFieldParentID

1 Answer 55 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Sanjoy
Top achievements
Rank 1
Sanjoy asked on 15 Jun 2012, 08:54 AM
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

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 15 Jun 2012, 10:25 AM
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.
Tags
TreeView
Asked by
Sanjoy
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Share this question
or