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

On-demand loading: hide expand control when no children

1 Answer 99 Views
TreeList
This is a migrated thread and some comments may be shown as answers.
Kristof
Top achievements
Rank 1
Kristof asked on 12 Apr 2012, 01:59 PM
Hi,

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,
Kristof

1 Answer, 1 is accepted

Sort by
0
Richard
Top achievements
Rank 1
answered on 16 Apr 2012, 03:20 PM
Kristof:

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.
Tags
TreeList
Asked by
Kristof
Top achievements
Rank 1
Answers by
Richard
Top achievements
Rank 1
Share this question
or