This is a migrated thread and some comments may be shown as answers.

OnClientDropping When Destination is RadTreeView

2 Answers 67 Views
ListBox
This is a migrated thread and some comments may be shown as answers.
Jon Shipman
Top achievements
Rank 1
Jon Shipman asked on 04 Nov 2010, 12:36 AM
I have a situation where I drag from a RadListBox to a RadTreeView.  It is quite similar to this Telerik example.

When a RadListBoxItem is dropped, it fires the OnClientDropping event.  The event argument has a get_sourceItem() method where I can access the RadListBoxItem and its attributes.  The event argument also has a get_destinationItem() method, but it is coming up null.  I'm guessing this is because the destination item is a RadTreeNode and not a RadListBoxItem.

I need to compare a custom attribute in the source and destination items before I allow the drop to occur.  How can I get a reference to the destination RadTreeNode and check its custom attributes inside the OnClientDropping event handler?

Thanks!


2 Answers, 1 is accepted

Sort by
0
Accepted
Simon
Telerik team
answered on 04 Nov 2010, 02:41 PM
Hi Jon Shipman,

You can extract the Node in this way:
functon onListBoxDropping(sender, eventArgs) {
    var target = eventArgs.get_htmlElement();
    var node = treeView._extractNodeFromDomElement(target);
    if (node) ...
}

Where treeView is a reference to the client-side object of the RadTreeView.

I hope this helps.

Kind regards,
Simon
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Jon Shipman
Top achievements
Rank 1
answered on 04 Nov 2010, 05:18 PM
Works perfect!  Thanks for the fast reply and the excellent customer service!

To be clear for others, I added the following line to the JavaScript as you suggested.

var treeView = $find("<%=RadTreeView1.ClientID %>");
Tags
ListBox
Asked by
Jon Shipman
Top achievements
Rank 1
Answers by
Simon
Telerik team
Jon Shipman
Top achievements
Rank 1
Share this question
or