PanelBar HtmlHelper Overview

The Telerik UI PanelBar HtmlHelper for ASP.NET Core is a server-side wrapper for the Kendo UI PanelBar widget.

The PanelBar displays hierarchical data as a multi-level, expandable widget.

Basic Configuration

The following example demonstrates the basic configuration of the PanelBar HtmlHelper.

    @(Html.Kendo().PanelBar()
        .Name("panelbar")
        .ExpandMode(PanelBarExpandMode.Single)
        .Items(items =>
        {
            items.Add().Text("Root1")
                .Items(subitems =>
                {
                    subitems.Add().Text("Level2 1");
                    subitems.Add().Text("Level2 2");
                });
            items.Add().Text("Root2")
                .Items(subitems =>
                {
                    subitems.Add().Text("Level2 1");
                    subitems.Add().Text("Level2 2");
                });
        })
    )

Functionality and Features

Events

You can subscribe to all PanelBar events. For a complete example on basic PanelBar events, refer to the demo on using the events of the PanelBar.

Handling by Handler Name

The following example demonstrates how to subscribe to events by a handler name.

    @(Html.Kendo().PanelBar()
            .Name("panelbar")
            .Events(e => e
                .Expand("panelbar_expand")
                .Collapse("panelbar_collapse")
            )
    )
    <script>
        function panelbar_collapse() {
            // Handle the collapse event.
        }

        function panelbar_expand() {
            // Handle the expand event.
        }
    </script>

Handling by Template Delegate

The following example demonstrates how to subscribe to events by a template delegate.

@(Html.Kendo().PanelBar()
    .Name("panelbar")
    .Events(e => e
        .Expand(@<text>
            function() {
                // Handle the expand event inline.
            }
        </text>)
        .Collapse(@<text>
            function() {
                // Handle the collapse event inline.
            }
        </text>)
    )
)

Referencing Existing Instances

To reference an existing PanelBar instance, use the jQuery.data() configuration option. Once a reference is established, use the client-side PanelBar API to control its behavior.

// Place this after the PanelBar for ASP.NET Core declaration.
<script>
    $(document).ready(function() {
        // The Name() of the panelbar is used to get its client-side instance.
        var panelbar = $("#panelbar").data("kendoPanelBar");
    });
</script>

See Also

In this article
Not finding the help you need? Improve this article