TreeView Clicked Node's Content

4 posts, 0 answers
  1. Yngwie
    Yngwie  avatar
    11 posts
    Member since:
    Sep 2008

    Posted 15 Apr 2009 Link to this post

    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?
  2. Yngwie
    Yngwie  avatar
    11 posts
    Member since:
    Sep 2008

    Posted 15 Apr 2009 Link to this post

    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?
  3. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 16 Apr 2009 Link to this post

    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.
  4. Yngwie
    Yngwie  avatar
    11 posts
    Member since:
    Sep 2008

    Posted 16 Apr 2009 Link to this post

    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 ;)
Back to Top