Last Updated: 23 Aug 2017 15:17 by Alex
Marin Bratanov
Created on: 17 May 2017 13:37
Category: PanelBar
Type: Bug Report
Collapsing of items with ItemTemplate
You should, in general, use the ContentTemplate to provide content to items.

By original design and old documentation, the ItemTemplate must not be collapsible at all, but since it has been for ages, we must fix that to avoid a breaking change.

Items that have an ItemTemplate have the following collapse/expand issues:

    - they require two clicks to collapse for the first time
    - setting Expanded=false on the server keeps the ItemTemplate expanded
    - until you click their header they do not heave the coloring and expand/collapse arrow

See this changeset on how the templates should work and the change from the previous descriptions: https://github.com/telerik/ajax-docs/commit/67f0a252ff24e2397e042fe5797de3610a75221d which is available in the following article http://docs.telerik.com/devtools/aspnet-ajax/controls/panelbar/templates/overview
1 comment
Posted on: 17 May 2017 14:32
I find the main issue with that fact that the items "require two clicks to collapse".  So obviously, the functionality is there but you don't give the users control over initial state.

It doesn't matter what historically Telerik intended to do with this control.  What matters is what users are expecting.  I saw hundreds of posts on the internet by people struggling with this issue.  BTW, I read the documentation about ContentTemplate and ItemTemplate about 5 times and still cannot get it (very poor explanation and unless you already struggle you would not even look into it).  Why not simple say, that ContentTemplate should be used on items with no children (however if the item has no children and someone is declaring ItemTemplate isn't it the same as ContentTemplate?).

Besides, I chose your own example to demonstrate the issue.  My case is actually a little different.  I don't even use templates.  I use child Controls collection to build content.  Everything looks good except the control over initial state.  My children HTML and controls are wrapped in a div with class "rpTemplate" which when collapsed is set as "invisible".  I would like that control on the server site right from the start.

Just wanted you to know that I lost a lot of time on this and I feel that if I wont be able to find a solution quickly I'll probably decide to use different control altogether.  This is a pattern that I find working with Telerik controls for over 7 years.  Small issues take 95% percent of work and sometimes make the control totally unusable.

Thank you,
Christopher Borys