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

TreeView is not recognized like a DestinationHtmlElement

2 Answers 87 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Silvio Silva Junior
Top achievements
Rank 2
Silvio Silva Junior asked on 03 May 2010, 03:03 PM
Hello.

I have a page with a TreeView in the left and a ListView in the right. In TelerikListView1_ItemDrop event, I try to get the "e.DestinationHtmlElement" when I drop a item in a TreeView node, but, the DestinationHtmlElement is empty.

I tryed with a link button, dropping a item item from the ListView in the linkbutton, and yes, the DestinationHtmlElement was the linkbutton ID.

What's wrong with TreeView?

Regards.

2 Answers, 1 is accepted

Sort by
0
Silvio Silva Junior
Top achievements
Rank 2
answered on 03 May 2010, 03:29 PM
In the attach file, is the page with controls, to a better visualization.

I would attach my project, but I don't know how.

Regards.
0
Accepted
Veli
Telerik team
answered on 04 May 2010, 02:23 PM
Hi Silvio,

There are no attachments in the forum thread, but that's OK. The reason you do not get any IDs passed to the server is because RadTreeView nodes do not have IDs of their own. When listview items are dropped on HTML elements, the client ID of the destination element is passed to the server. If the latter does not have an IDs, you do not get anything.

To work around this, there are a couple of options you can take:

Option 1. Give an id to your destination element dynamically. You can use RadListView's client-side OnItemDropping event to get the destination element and give it an id:

function itemDropping(sender, args)
{
    var el = args.get_destinationElement();
    if(el && !el.id)
    {
        el.id = "myCustomTargetElementID";
    }
}

Of course, you can use Templates for RadTreeView and put an element with an ID where the listview item would be dropped. That's just one option

Option 2. Use some other means to save custom data that will be useful on the server. For example, you can save the inner HTML of the target tree view node into a hidden field on page. Then you can use this value in the ItemDrop server event event of the list view instead of the destination HTML id.


Sincerely yours,
Veli
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.
Tags
ListView
Asked by
Silvio Silva Junior
Top achievements
Rank 2
Answers by
Silvio Silva Junior
Top achievements
Rank 2
Veli
Telerik team
Share this question
or