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

TreeView Clicked Node's Content

3 Answers 59 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Yngwie
Top achievements
Rank 1
Yngwie asked on 15 Apr 2009, 01:28 PM
Hi everyone, I have TreeView and shows some Data from DB. And I'd like to get content of clicked node from the DB. I mean when I click some node, it must brings some content related node from DB to another table or div. Can you help me about it?

3 Answers, 1 is accepted

Sort by
0
Yngwie
Top achievements
Rank 1
answered on 15 Apr 2009, 08:22 PM
Hmm, I thought someone replied in a short time, but not :) Anyway, If anyone don't understand or don't know how to do it but at least can someone tell me how to get SelectedNode's ID and keep it a Session or get it by using JavaScript?
0
Shinu
Top achievements
Rank 2
answered on 16 Apr 2009, 07:52 AM
Hello,

Attach handler to the OnNodeClick event and inside that it is possible to get the clicked node text and value. I hope this is suitable for your scenario.

[ASPX]
 
<telerik:radtreeview id="RadTreeView1" runat="server" OnNodeClick="RadTreeView1_NodeClick"
<Nodes> 
  . . . 
</Nodes> 
</telerik:radtreeview> 

[CS]
 
protected void RadTreeView1_NodeClick(object sender, Telerik.Web.UI.RadTreeNodeEventArgs e) 
    String clickedNodeText = e.Node.Text; 
    String clickedNodeValue = e.Node.Value;     
    //Use Sql query to get the content from database according to selected node 
Please feel free to correct me if I have not got your scenario right.

Thanks,
Shinu.
0
Yngwie
Top achievements
Rank 1
answered on 16 Apr 2009, 02:44 PM
Thanks Shinu, for your interest and your example, but I just solved my problem, it was easier than I guess.

I do it with : "RadTreeView.SelectedNode.Value" method ;)
Tags
TreeView
Asked by
Yngwie
Top achievements
Rank 1
Answers by
Yngwie
Top achievements
Rank 1
Shinu
Top achievements
Rank 2
Share this question
or