TreeView is not recognized like a DestinationHtmlElement

3 posts, 1 answers
  1. Silvio Silva Junior
    Silvio Silva Junior avatar
    100 posts
    Member since:
    Mar 2010

    Posted 03 May 2010 Link to this post

    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. Silvio Silva Junior
    Silvio Silva Junior avatar
    100 posts
    Member since:
    Mar 2010

    Posted 03 May 2010 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Answer
    Veli
    Admin
    Veli avatar
    2002 posts

    Posted 04 May 2010 Link to this post

    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.
Back to Top