Prevent Editor opening depending on the node

3 posts, 0 answers
  1. Marco
    Marco avatar
    87 posts
    Member since:
    Apr 2011

    Posted 22 Apr Link to this post

    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. Dess
    Admin
    Dess avatar
    1609 posts

    Posted 26 Apr Link to this post

    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.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Marco
    Marco avatar
    87 posts
    Member since:
    Apr 2011

    Posted 27 Apr in reply to Dess Link to this post

    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

Back to Top