I had populated data in TreeView control. How will I drag a particular child node from a parent node and drop the dragged one to a DIV or any portion, using JQUERY ? I know in jquery, there are methods “draggable” and “droppable” to make this possible. But I want to drag a particular child node and drop it.
Or atleast How to fetch the text/id of a particular child node using jquery ? I hope I can drag,if I can fetch the child node
Ok I add this as another answer because the comment box is to small,
To hide/show an item while dragging you can use the start and stop events.
This example shows/hides the +/- (collapse/uncollapse) icon next to the treenode text while dragging but you can easily modify it to hide/show the checkboxes if present.
I’ll try to have a look at the clone problem.
— edit —
Apparently the clone problem is only in IE and is caused by the
In conjunction with
This puts the treeNode class not only on the “a” tag but also on the surrounding “td” tag. So by using the .treeNode selector the draggable method is executed twice … This is not the case in FF.
You could solve this by just changing the selector in “#<%= TreeView1.ClientID%> a.treeNode”
So with the afore mentioned aspx you would get the following script.
— edit —
In answer to your comment:
To get the value of the dragged node you can use javascript string manipulation to filter it out of the href attribute (treenode renders the value in the href attr).
Your javascript in the drop function could look like the following. (still need to do some checking for null values ofcourse)
Or you can make it a little cleaner client-side by inheriting Treenode and wrap every Treenode by a div with a custom attribut in which you put your clientside id.
Your custom treenode could look like this
Then in your aspx use (register you custom web control assembly first)
instead of
And your javascript stays nice and clean