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

PanelBar Template

4 Answers 246 Views
PanelBar
This is a migrated thread and some comments may be shown as answers.
Erik
Top achievements
Rank 1
Erik asked on 23 Mar 2018, 08:19 AM

Hello,

I've got some problems with add template to PanelBar. I've just tried simple code bellow ... but it doesn't work (and no error raised)

Could you help me?

@{
        List<PanelBarItemModel> panelBarList = new List<PanelBarItemModel>();
        panelBarList.Add(new PanelBarItemModel() { Id = "1", Text = "val1" });
        panelBarList.Add(new PanelBarItemModel() { Id = "2", Text = "val2" });
 
    }
 
    <script id="panelbar-template" type="text/kendo-ui-template">
        #: item.Id # - #: item.text #
    </script>
 
    @(Html.Kendo().PanelBar()
            .Name("TestPanelBar")
            .TemplateId("panelbar-template")
            .ExpandMode(PanelBarExpandMode.Multiple)
            .BindTo(panelBarList)
    )

4 Answers, 1 is accepted

Sort by
0
Accepted
Dimitar
Telerik team
answered on 23 Mar 2018, 02:31 PM
Hello Erik,

When Telerik UI for ASP.NET Core PanelBar is bound using its BindTo method, the items are rendered on the server and templates (which are client-side) cannot be used.
Templates can be used when defining a PanelBar datasource, as shown on PanelBar Templates demo.

Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
0
Erik
Top achievements
Rank 1
answered on 23 Mar 2018, 07:28 PM
Thank you
0
Erik
Top achievements
Rank 1
answered on 26 Mar 2018, 01:39 PM

Hello,

I've got one last question about datasources. I've check the example you send me. The loading of simple IEnumerable data was successful. But what about hierarchical data? I found out that the controller action Read_TemplateData(string id) is called many times (for each item with descendants), but i can't find how i is possible. Could you explain me the mechanism behind? 

Thanks.

0
Dimitar
Telerik team
answered on 27 Mar 2018, 03:03 PM
Hello Erik,

Templates demo controller calls two methods - GetProjectData() and GetChildren(is), which are defined in the PanelBar Models inside the demos project. I have attached the relevant files to my reply. When installing Telerik UI for ASP.NET Core locally, the demos project is also installed and you may browse it locally and play with the demos code. Its default installation path is C:\Program Files (x86)\Progress\Telerik UI for ASP.NET Core R1 2018\wrappers\aspnetcore\Examples\AspNet.Core\VS2017\Kendo.Mvc.Examples . Then double click the .csproj file.

Regards,
Dimitar
Progress Telerik
Try our brand new, jQuery-free Angular components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Tags
PanelBar
Asked by
Erik
Top achievements
Rank 1
Answers by
Dimitar
Telerik team
Erik
Top achievements
Rank 1
Share this question
or