PanelBar Template

5 posts, 1 answers
  1. Erik
    Erik avatar
    3 posts
    Member since:
    Dec 2017

    Posted 23 Mar 2018 Link to this post

    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)
        )
  2. Answer
    Dimitar
    Admin
    Dimitar avatar
    447 posts

    Posted 23 Mar 2018 Link to this post

    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.
  3. Erik
    Erik avatar
    3 posts
    Member since:
    Dec 2017

    Posted 23 Mar 2018 in reply to Dimitar Link to this post

    Thank you
  4. Erik
    Erik avatar
    3 posts
    Member since:
    Dec 2017

    Posted 26 Mar 2018 Link to this post

    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.

  5. Dimitar
    Admin
    Dimitar avatar
    447 posts

    Posted 27 Mar 2018 Link to this post

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