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

Add Node in Edit Mode with text

1 Answer 96 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
Davide
Top achievements
Rank 1
Davide asked on 18 Apr 2012, 10:36 AM
Hi all  Telerik team,
   I would like  to add/edit  node and show the node text in the treeviewtextboxeditor as inizialized value , but the editor appear with empty text.

I try to set value in the Valdiating event but this code ends the editing mode and user cannot modify the value
void rtvCustomTags_Editing(object sender, Telerik.WinControls.UI.TreeNodeEditingEventArgs e)
{
    e.Editor.Value = e.Node.Text;
}


can you help me, please?
Thank you

1 Answer, 1 is accepted

Sort by
0
Accepted
Stefan
Telerik team
answered on 21 Apr 2012, 02:40 PM
Hello Davide,

Thank you for writing.

In order to set the node's text to its editor, you should use the EditorInitialized event of RadTreeView. Here is a sample code:
public Form1()
{
    InitializeComponent();
 
    radTreeView1.AllowEdit = true;
    radTreeView1.EditorInitialized += new Telerik.WinControls.UI.TreeNodeEditorInitializedEventHandler(radTreeView1_EditorInitialized);
}
 
void radTreeView1_EditorInitialized(object sender, Telerik.WinControls.UI.TreeNodeEditorInitializedEventArgs e)
{
    e.Editor.Value = e.Node.Text;
}

I hope that you find this information useful.
 
Regards,
Stefan
the Telerik team
RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
Tags
Treeview
Asked by
Davide
Top achievements
Rank 1
Answers by
Stefan
Telerik team
Share this question
or