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

Treeview Selction and Edit the node

1 Answer 65 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
Baskar
Top achievements
Rank 1
Baskar asked on 12 Sep 2011, 02:45 PM
Dear Experts,
am using tree view selection change event to get the selected item and am able to get the selected item by using the below code

void treeView_SelectionChanged(object sender, Telerik.Windows.Controls.SelectionChangedEventArgs e)
        {
            RadTreeView tv = e.OriginalSource as RadTreeView;

            //get the selected Item from the treeview.
            selectedItem = tv.SelectedItem as RadTreeViewItem;

            if (treeView.SelectedContainer != null && this.treeView.SelectedContainer != selectedItem)
            {
                this.treeView.SelectedContainer.IsInEditMode = false;
            }

            if (selectedItem != null)
            {
                selectedItem.IsInEditMode = true;
                selectedItem.BeginEdit();
            }
        }

and i have add button_click event ann call the add method as shown below

 private void AddItem()
        {
            if (selectedItem  == null)
            {               
                    RadTreeViewItem newItem = new RadTreeViewItem()
                    {
                        Header = "New root"
                    };
                    treeView.Items.Add(newItem);
                   
            }
            else
            {
                RadTreeViewItem newItem = new RadTreeViewItem()
                {
                    Header = "New Child"
                };
                selectedItem.Items.Add(newItem);                                     
            }                     
           
The problem is when i add the new node, and its in editable, and am able to edit, but when click on the each node in the treeview all the item in the text gets disabled. i don't whats wrong in my code.

i need to add the new node with the edit functionality.

Thanks in Advance.

1 Answer, 1 is accepted

Sort by
0
Petar Mladenov
Telerik team
answered on 15 Sep 2011, 11:59 AM
Hello Baskar,

 Could you please check out this thread and the post from Hristo from 12 September 2011. He describes two issues with the edit mode of the RadTreeView. Can you confirm that one of those has to do with your scenario?

Greetings,
Petar Mladenov
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Tags
TreeView
Asked by
Baskar
Top achievements
Rank 1
Answers by
Petar Mladenov
Telerik team
Share this question
or