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

Edited node text changes when adding new node

2 Answers 68 Views
TreeView
This is a migrated thread and some comments may be shown as answers.
bdk0172
Top achievements
Rank 1
bdk0172 asked on 06 Mar 2008, 09:51 PM
I followed the example in the documentation help file(ms-help://telerik.radcontrols.prometheus.2007.Q3/telerik.radcontrols.prometheus.2007.Q3/tree_ContextMenuOverview.html) to display Add and Delete on a right-click.  If I add a new node so that it's text is "New node" and then double-click to edit the text to anything else, when I add another new node, it creates the new node with text "New node", but also resets the text of the node I just edited back to "New node".

This can easily be duplicated in your online demo at http://www.telerik.com/DEMOS/ASPNET/Prometheus/TreeView/Examples/Functionality/ContextMenu/DefaultCS.aspx.

Right-click on "Public Folders" and select "New Folder".  Then double-click and change the text to "My Folder".  Now, right-click again on "Public Folders" and select "New Folder".  There are now two folders named "New Folder" instead of one named "My Folder" and one named "New Folder".

2 Answers, 1 is accepted

Sort by
0
Accepted
Nikolay
Telerik team
answered on 07 Mar 2008, 08:53 AM
Hi there,

You should hook on the NodeEdit event of the treeview to keep the changes to the edited node after postback. The NodeEdit event should be wired as:

protected void RadTreeView1_NodeEdit(object sender, RadTreeNodeEditEventArgs e)
        {
            RadTreeNode nodeEdited = e.Node;
            string newText = e.Text;
            nodeEdited.Text = newText;
        }

An example can be seen at:
Node Text Editing

Hope this helps.

Regards,
Nick
the Telerik team

Instantly find answers to your questions at the new Telerik Support Center
0
john
Top achievements
Rank 1
answered on 23 Aug 2008, 05:12 AM
Hi,

I have a problem in editing node.  After I hit the enter key, the original text of the node is displayed, not the newly inputted text.

Thanks.
Tags
TreeView
Asked by
bdk0172
Top achievements
Rank 1
Answers by
Nikolay
Telerik team
john
Top achievements
Rank 1
Share this question
or