OnClientDropping When Destination is RadTreeView

3 posts, 1 answers
  1. Jon Shipman
    Jon Shipman avatar
    43 posts
    Member since:
    Nov 2009

    Posted 03 Nov 2010 Link to this post

    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?


  2. Answer
    Simon avatar
    2281 posts

    Posted 04 Nov 2010 Link to this post

    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,
    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
  3. Jon Shipman
    Jon Shipman avatar
    43 posts
    Member since:
    Nov 2009

    Posted 04 Nov 2010 Link to this post

    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 %>");
Back to Top