SelectedNodes.Clear() Not Clearing the selected nodes

2 posts, 0 answers
  1. Frank
    Frank avatar
    103 posts
    Member since:
    Mar 2012

    Posted 11 Jul 2014 Link to this post

    I have an application and when the user hit a button I want to clear the selected nodes in the treeview.  I have tried SelectedNodes.Clear() but the selects remain.
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 13 Jul 2014 in reply to Frank Link to this post

    Hi Frank,

    In order to clear the selected node please try the below approach which works fine at my end.

    protected void rbtnClearSelection_Click(object sender, EventArgs e)
        foreach (Telerik.Web.UI.RadTreeNode node in rtreeviewTestNodes.Nodes)
            if (node.Selected)
                node.Selected = false;
            if (node.Nodes.Count > 0)
                foreach (Telerik.Web.UI.RadTreeNode subNode in node.Nodes)
                    if (subNode.Selected)
                        subNode.Selected = false;

Back to Top