how to get checked node from treeview

2 posts, 0 answers
  1. SachinC
    SachinC avatar
    23 posts
    Member since:
    Sep 2010

    Posted 22 Oct 2010 Link to this post


    I am using radtreeview. and added rootnode and child nodes to it,showing checkbox for each node (parent and child node).
    after that i am selecting many nodes (Checkbox). after clicking remove button. i need to remove the checked nodes from treeview as well as from database.

    So, how to get the collection of checked nodes?

    Please help?

    Sachin C
  2. Richard Slade
    Richard Slade avatar
    3000 posts
    Member since:
    May 2009

    Posted 22 Oct 2010 Link to this post

    Hi Sachin,

    This will get you a collection of nodes that are checked. I've adapted the code at this Code Library Article

    Private m_CheckedNodes As New System.Collections.Generic.List(Of Telerik.WinControls.UI.RadTreeNode)

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        For Each node As Telerik.WinControls.UI.RadTreeNode In RecursiveTreeTraversal(Me.RadTreeView1.Nodes)
    End Sub
    Private Function RecursiveTreeTraversal(ByVal levelNodes As Telerik.WinControls.UI.RadTreeNodeCollection) As System.Collections.Generic.List(Of Telerik.WinControls.UI.RadTreeNode)
        For Each node As Telerik.WinControls.UI.RadTreeNode In levelNodes
            If node.Checked Then
            End If
        Return m_CheckedNodes
    End Function

    and in C#
    private System.Collections.Generic.List<Telerik.WinControls.UI.RadTreeNode> m_CheckedNodes = new System.Collections.Generic.List<Telerik.WinControls.UI.RadTreeNode>();
    private void Form1_Load(System.Object sender, System.EventArgs e)
        foreach (Telerik.WinControls.UI.RadTreeNode node in RecursiveTreeTraversal(this.RadTreeView1.Nodes)) {
    private System.Collections.Generic.List<Telerik.WinControls.UI.RadTreeNode> RecursiveTreeTraversal(Telerik.WinControls.UI.RadTreeNodeCollection levelNodes)
        foreach (Telerik.WinControls.UI.RadTreeNode node in levelNodes) {
            if (node.Checked) {
        return m_CheckedNodes;

    hope that helps
  3. DevCraft R3 2016 release webinar banner
Back to Top