Hi,
This seems like the simplest thing in the world to do, but I have been unable (as yet) to simply remove a treenode from the TreeView control. I've created a RadForm with JUST a RadTreeView on it, added a handful of items, then simply responded to the SelectedNodeChanged() event to delete the node clicked. This isn't what it's going to do in real life, but it's a simple test. It doesn't work if I do the delete from a button event etc.
Here's the list of items:
Then the event to delete the selected node:
I've set AllowRemove to true in the Design Interface and in the code, but nothing. I've hooked the NodeRemoved() event to see if it's actually doing it, but nothing. The Event treeMenu_SelectedNodeChanged() is firing fine, and I'm not seeing the NodeRemove() event at all (and nothing is removed from the tree).
Help! This is just bugging me now!
Thanks,
Paul
This seems like the simplest thing in the world to do, but I have been unable (as yet) to simply remove a treenode from the TreeView control. I've created a RadForm with JUST a RadTreeView on it, added a handful of items, then simply responded to the SelectedNodeChanged() event to delete the node clicked. This isn't what it's going to do in real life, but it's a simple test. It doesn't work if I do the delete from a button event etc.
Here's the list of items:
treeMenu.AllowRemove =
true
;
treeMenu.NodeRemoved +=
new
RadTreeView.RadTreeViewEventHandler(treeMenu_NodeRemoved);
RadTreeNode rootNode =
new
RadTreeNode(
"Menu"
,
true
);
RadTreeNode homeMenu =
new
RadTreeNode(
"Home"
,
true
);
RadTreeNode servicesMenu =
new
RadTreeNode(
"Our Services"
,
true
);
servicesMenu.Nodes.Add(
new
RadTreeNode(
"Compliance Services"
,
true
));
servicesMenu.Nodes.Add(
new
RadTreeNode(
"Support Services"
,
true
));
servicesMenu.Nodes.Add(
new
RadTreeNode(
"Consultancy & Systems Advice"
,
true
));
servicesMenu.Nodes.Add(
new
RadTreeNode(
"Business Startup"
,
true
));
rootNode.Nodes.Add(homeMenu);
rootNode.Nodes.Add(servicesMenu);
treeMenu.Nodes.Add(rootNode);
Then the event to delete the selected node:
private
void
treeMenu_SelectedNodeChanged(
object
sender, RadTreeViewEventArgs e)
{
treeMenu.Nodes.Remove(e.Node);
}
I've set AllowRemove to true in the Design Interface and in the code, but nothing. I've hooked the NodeRemoved() event to see if it's actually doing it, but nothing. The Event treeMenu_SelectedNodeChanged() is firing fine, and I'm not seeing the NodeRemove() event at all (and nothing is removed from the tree).
Help! This is just bugging me now!
Thanks,
Paul