My updated code is not working. Any ideas?
Try
Select Case e.MenuItem.Text.ToLower
Case "delete"
e.Node.Remove()
statusLabel.Text =
"You deleted " & e.Node.Text
' save the changes
Case "move up"
'move the selected node one place up
'here's what we're gonna do:
'Check if this node is already at the top
'If not, switch it with the node directly above him, same goes for moving the node down...
If Not e.Node.Value = e.Node.ParentNode.Nodes(0).Value Then
Dim i As Integer = 0
While i < e.Node.ParentNode.Nodes.Count
If e.Node.Value = e.Node.ParentNode.Nodes(i).Value Then
'Because of the i-value, we are going to 'walk' through the
'second layer of the tree (radtreeview1.nodes(0).nodes)
'This part is a bit nasty programming, first we remove the node before the node we want to move
'our nodeclicked is now automatically moving one place up,
'than we insert the removed node one place under the moved node
'et voila
Dim tempNode As New Telerik.Web.UI.RadTreeNode
tempNode = e.Node.ParentNode.Nodes(i - 1)
m_RadTreeFolderHierarchy.Nodes(0).Nodes.RemoveAt(i - 1)
m_RadTreeFolderHierarchy.Nodes(0).Nodes.Insert(i, tempNode)
End If
i += 1
End While
End If
Case "move down"
'move the selected node one place down
If Not e.Node.Value = e.Node.ParentNode.Nodes(e.Node.ParentNode.Nodes.Count - 1).Value Then
Dim i As Integer = 0
While i < e.Node.ParentNode.Nodes.Count
If e.Node.Value = e.Node.ParentNode.Nodes(i).Value Then
'Because of the i-value, we are going to 'walk' through the
'second layer of the tree (radtreeview1.nodes(0).nodes)
'This part is a bit nasty programming, first we remove the node AFTER the node we want to move
'our nodeclicked is now automatically moving one place down,
'than we insert the removed node one place ABOVE the moved node
'et voila
Dim tempNode As New Telerik.Web.UI.RadTreeNode
tempNode = e.Node.ParentNode.Nodes(i + 1)
m_RadTreeFolderHierarchy.Nodes(0).Nodes.RemoveAt(i + 1)
m_RadTreeFolderHierarchy.Nodes(0).Nodes.Insert(i, tempNode)
Exit While
End If
i += 1
End While
End If
End Select
treeview_SaveChanges()
Catch ex As Exception