Hi there.
I am using the TreeView and trying to implement the drag and drop functionality for reordering. I have setup the NodeDrop event as per the documentation using e.SourceDragNode and e.DestDragNode. The DestDragNode works fine however the SourceDragNode always seems to return null.
Setup is as follows ...
ASPX...
<
telerik:RadTreeView ID="treeMenu" runat="server" DataTextField="Text" DataValueField="Value"
AllowNodeEditing="True" EnableDragAndDrop="True" EnableViewState="True"
EnableDragAndDropBetweenNodes="True" OnNodeDrop="treeMenu_NodeDrop"
CheckBoxes="True" >
<CollapseAnimation Type="OutQuint" Duration="100"></CollapseAnimation>
<ExpandAnimation Duration="100"></ExpandAnimation>
</telerik:RadTreeView>
C#...
protected
void treeMenu_NodeDrop(object sender, RadTreeNodeDragDropEventArgs e)
{
RadTreeNode sourceNode = e.SourceDragNode;
RadTreeNode destNode = e.DestDragNode;
RadTreeViewDropPosition dropPosition = e.DropPosition;
if (destNode != null)
{
if (sourceNode.TreeView.SelectedNodes.Count <= 1)
{
PerformDragAndDrop(dropPosition, sourceNode, destNode);
}
else if (sourceNode.TreeView.SelectedNodes.Count > 1)
{
foreach (RadTreeNode node in sourceNode.TreeView.SelectedNodes)
{
PerformDragAndDrop(dropPosition, node, destNode);
}
}
destNode.Expanded = true;
sourceNode.TreeView.ClearSelectedNodes();
}
}
private
static void PerformDragAndDrop(RadTreeViewDropPosition dropPosition, RadTreeNode sourceNode, RadTreeNode destNode)
...
Please can someone help me to understand why this is happening???
many thanks