Node Removing event?

2 posts, 0 answers
  1. Scott
    Scott avatar
    3 posts
    Member since:
    Jul 2010

    Posted 06 Jan 2013 Link to this post

    I have a variety of actions that need to take place prior to NodeRemoved event firing.  I will typically use the Gridview_RowsChanging, NotifyCollectionChangedAction.Replace or NotifyCollectionChangedAction.Remove (as an example) which work well and I'm looking for something similar to capture the action of a treeview  context menu (Add/Delete).

    Any thoughts?
  2. Stefan
    Stefan avatar
    2908 posts

    Posted 09 Jan 2013 Link to this post

    Hi Scott,

    Thank you for writing.

    Currently, there is not such event in RadTreeView. The available events will fire once the node is removed from the Nodes collection. There is a feature request for such in our Public Issue Tracking System. Feel free to add your vote for it here:

    What I can offer is to subscribe to the click event of the &Delete menu item in the context menu and perform the logic there, even though the node will no longer be in the Nodes collection. If you want to access this node, you can save it when the context menu is being opened:
    RadTreeNode saveNode;
    void radTreeView1_ContextMenuOpening(object sender, TreeViewContextMenuOpeningEventArgs e)
        foreach (RadMenuItem item in e.Menu.Items)
            if (item.Text == "&Delete")
                saveNode = e.Node;
                item.Click -= item_Click;
                item.Click += item_Click;
    void item_Click(object sender, EventArgs e)
        //delete option from context menu is pressed

    All the best,
    the Telerik team
    Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
Back to Top