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

Highlighting node

2 Answers 39 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Bill
Top achievements
Rank 2
Bill asked on 08 Aug 2010, 07:00 PM
I have a Save button on my form in the bottom center of my page. I have a treeview on the left.

When I click on my Save button, I will perform some validation with some other items on the screen. If the validation passes, I would like the treeview on the left to set the color on the present node to red and then to move down to the next node in the tree.

Question is, how do I get a reference to the treeview and those nodes from clicking my Save button in order to perform those functions?

Thanks,

Bill

2 Answers, 1 is accepted

Sort by
0
Veronica
Telerik team
answered on 10 Aug 2010, 01:49 PM
Hello William Yeager,

You can access the RadTreeView directly via it's ID in the Save_Click handler. Here's a sample code:

protected void Save_Click(object sender, EventArgs e)
    {
        RadTreeNode currentNode = RadTreeView1.SelectedNode;
        currentNode.CssClass = "highlight";
        if (currentNode.Next != null)
        {
            currentNode.Next.Selected = true;
        }
        else if(currentNode.ParentNode != null)
        {
            currentNode.ParentNode.Next.Selected = true;
        }
    }

Have in mind that Next property returns the next node only for the current level.

Please let me know if you have more questions.

Kind regards,
Veronica Milcheva
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Bill
Top achievements
Rank 2
answered on 12 Aug 2010, 12:37 AM
Thanks Veronica. I appreciate it....
Tags
TreeView
Asked by
Bill
Top achievements
Rank 2
Answers by
Veronica
Telerik team
Bill
Top achievements
Rank 2
Share this question
or