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

Prevent Editor opening depending on the node

2 Answers 76 Views
Treeview
This is a migrated thread and some comments may be shown as answers.
Marco
Top achievements
Rank 2
Veteran
Marco asked on 22 Apr 2016, 10:14 AM

Hello

I have found that we can allow the editor on the radtreeview level with the AllowEdit Property.

But on my treeview I have some nodes which should be editable and other which aren't.

How could I handle this ? Is it possible to prevent the initialization of the editor for some specific node ?

Thanks for you support

2 Answers, 1 is accepted

Sort by
0
Dess | Tech Support Engineer, Principal
Telerik team
answered on 26 Apr 2016, 10:36 AM
Hello Marco,

Thank you for writing.

In order to restrict nodes editing, you can cancel the RadTreeView.Editing event for the specific node. Additional information regarding the editing process is available here: http://docs.telerik.com/devtools/winforms/treeview/editing/editing-nodes
public Form1()
{
    InitializeComponent();
     
    for (int i = 0; i < 10; i++)
    {
        RadTreeNode node = new RadTreeNode();
        node.Text = "Node" + i;
        node.Value = node.Text;
        this.radTreeView1.Nodes.Add(node);
    }
 
    this.radTreeView1.AllowEdit = true;
    this.radTreeView1.Editing += radTreeView1_Editing;
}
 
private void radTreeView1_Editing(object sender, TreeNodeEditingEventArgs e)
{
    if (e.Node.Text == "Node2")
    {
        e.Cancel = true;
    }
}

I hope this information helps. Should you have further questions I would be glad to help.

 Regards,
Dess
Telerik
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
0
Marco
Top achievements
Rank 2
Veteran
answered on 27 Apr 2016, 02:03 PM

Hi Dess,

The editing event is what I was looking for !

Don't know why I stuck on the EditorRequired and EditorInitialized.

Thanks for you support

Tags
Treeview
Asked by
Marco
Top achievements
Rank 2
Veteran
Answers by
Dess | Tech Support Engineer, Principal
Telerik team
Marco
Top achievements
Rank 2
Veteran
Share this question
or