ASP.NET 3.5 and above only

ASP.NET TreeView - Drag and drop core features


  • Dragging is disabled for the node, 'Recycle Bin'.
  • Dropping is disabled for the node, 'My Computer'.
  • Drag and dropping is disabled for the node, 'Desktop'

  • Desktop
    • My Documents
    • My Computer
      • Local Disk (C:)
        • Documents and Settings
          • All Users
          • Guest
        • Program Files
          • Common Files
          • MSDN
      • DVD-RAM Drive (E:)
      • Guest's Documents
    • My Network Places
    • Recycle Bin




[ASPX]

    <obout:Tree ID="OboutTree1" ClientObjectID="obTree1" EnableDragAndDrop="true"
        OnNodeDrop="OnClientNodeDrop" runat="server">
        <Nodes>
            <obout:Node Text="Desktop" AllowDrag="false" AllowDrop="false" Expanded="true"
                ImageUrl="~/obout.ajax.ui/treeview/examples/img/WinXP/desktop.gif">
                ...
                <obout:Node Text="My Computer"  AllowDrop="false" Expanded="true"
                    ImageUrl="~/obout.ajax.ui/treeview/examples/img/WinXP/2PCRemote.gif">
                ...
                <obout:Node Text="Recycle Bin" AllowDrag="false" ImageUrl="~/obout.ajax.ui/treeview/examples/img/WinXP/13Recycle.gif">
                </obout:Node>
            </obout:Node>
        </Nodes>
    </obout:Tree>
            
[JavaScript]

    function OnClientNodeDrop(sender, args) {
        var chk_conform = document.getElementById("<%=chk_conformNodeDrop.ClientID %>");
        if (chk_conform.checked) {
            var action = 
                confirm("Move '" + getNodeText(args.sourceNode) + "' to '" + getNodeText(args.target) + "'?");
            args.cancel = !action;
        }
    }
    function getNodeText(node) {
        return node.innerText != undefined ? node.innerText : node.textContent;
    }
            

"Boys… You are the best ones."

Alvaro Torres Tatis

Random testimonial   All testimonials