On-demand loading: hide expand control when no children

2 posts, 0 answers
  1. Kristof
    Kristof avatar
    1 posts
    Member since:
    Apr 2012

    Posted 12 Apr 2012 Link to this post


    We are switching from a Telerik Treeview to a TreeList in our application.

    In the treeview, we also did on-demand loading, there we could catch the OnNodeDataBound event, and if we see that there are no child items for that node, we could hide the expand button. So the user would only see the "+" in front of the nodes that actually have children (even though the children are not sent to the client yet).

    I attempted to do the same with the TreeList in the "ItemDataBound" event, but then I got the error that I cannot set the value of the item.CanExpand property. The best I could find is the "HideExpandCollapseButtonIfNoChildren" property, but then the user will still see the "+" in front of all items, and have to click it first to find out that there are no child items, which is not very user friendly.

    Is this possible with the treelist? If yes, how?

    Kind regards,
  2. jumpstart
    jumpstart avatar
    479 posts
    Member since:
    Nov 2011

    Posted 16 Apr 2012 Link to this post


    If you have not already done so, I would have a look at the following forum thread:

    Disabling Expand Button

    You should be able to modify the first code snippet provided by Veli to hide the expand button if there are no children.

    I hope this helps you.
  3. DevCraft R3 2016 release webinar banner
Back to Top