PanelBar HtmlHelper Overview

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

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

Basic Configuration

This runnable example demonstrates the basic configuration of the PanelBar HtmlHelper for ASP.NET MVC.

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>
    @(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 Kendo UI 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 MVC declaration.
<script>
    $(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