JScript
JScript file Ext.namespace (' Ext.test '); Ext.test.Panel = function () {this.right = new Ext.panel ({ddgroup: ' Treepanelddgroup ', border:true, id: ' Right ', title : ' Panel ', bodystyle: ' padding:5px ', defaults: {bodystyle: ' padding-left:5px '}}); This.left = new Ext.tree.TreePanel ({ddgroup: ' Treepanelddgroup ', Rootvisible:false, width:200, Split:true, Enabledd:tr UE, Title: "Drag Tree"/*loader:new Ext.tree.TreeLoader ({dataurl: "dtree.aspx"}), Root:new Ext.tree.AsyncTreeNode ({ID: ' Rootid ', text: ' Company '}/}); This.left.expandAll (); function Buildtree (config) {if (!config) return null; var c = config.children; config.leaf = c. false:true; var child, node = new Ext.tree.TreeNode (config); if (node && c && c.length) {for (var i = 0; i < C.length, i++) {child = Buildtree (c[i)); if (child) n Ode.appendchild (child); } return node; var Rootdrag = Buildtree ({id: ' Rootdrag ', text: ' Rootdrag ', children: [{id:1, Text: ' Childnode1 '}, {id:2, text: ' Ch Ildnode2'}, {id:3, text: ' Childnode3 '}, {id:4, text: ' Childnode4 '}, {id:5, text: ' Childnode5 '}]}; This.left.setRootNode (Rootdrag); This.right.on (' Render ', this.onrightrender, this); Ext.test.Panel.superclass.constructor.call (This, {renderto: ' Pagecontainer ', bodystyle: ' padding:5px ', height:500, W idth:760, title: ' Demo ', Layout: ' Table ', defaults: {height:200, width:200}, items: [This.left, This.right]} ; }; Ext.extend (Ext.test.Panel, Ext.panel, {onrightrender:function (CMP) {var sourcepaneldroptarget = new Ext.dd.DropTarget (Cmp.body.dom, {ddgroup: ' Treepanelddgroup ', notifydrop:function (Ddsource, E, data) {Ext.MessageBox.alert (Data.node) ; Cmp.add (New Ext.panel ({boder:true, Id:data.node, bodystyle: ' padding:5px ', defaults: {bodystyle: ' padding-left:5px ') } })); Cmp.dolayout (); Data.node.parentNode.removeChild (Data.node); return (true); } }); } }); Ext.onready (function () {Ext.QuickTips.init (); var panel = new Ext.test.Panel ();});
ASPX
<%@ Page language= "C #" autoeventwireup= true "codefile=" DragTreedropPanel.aspx.cs "inherits=" Dragtreedroppanel "%> <! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">