New to Telerik UI for ASP.NET Core? Download free 30-day trial

Razor Page

This article describes how to configure a Remote DataSource of a Telerik PanelBar in a RazorPage scenario.

In order to set up the PanelBar component bindings, you need to configure the Read method of its DataSource instance. The URL in this method should refer the name of the method in the PageModel. See the implementation details in the example below, and for the full project with RazorPages examples, visit our GitHub repository.

    @inject Microsoft.AspNetCore.Antiforgery.IAntiforgery Xsrf

        .DataSource(dataSource => dataSource
            .Read(read => read

    @inject Microsoft.AspNetCore.Antiforgery.IAntiforgery Xsrf

    <kendo-panelbar name="panelbar" datatextfield="Name">
                <read url="/PanelBar/PanelBarRemoteData?handler=Read" />

    public JsonResult OnGetRead(int? id)
        //employees is the DBContext
        var result = employees.ToList()
            .Where(v => id.HasValue ? v.ReportsTo == id : v.ReportsTo == null)
            .Select((employee) =>
                    id = employee.EmployeeID,
                    Name = employee.FirstName + " " + employee.LastName,
                    hasChildren = employees.Any(o => o.ReportsTo == employee.EmployeeID)
        return new JsonResult(result);

See Also

In this article