New to Telerik UI for ASP.NET CoreStart a free 30-day trial

PivotGridV2 in Razor Pages

Razor Pages is an alternative to the MVC pattern that makes page-focused coding easier and more productive. This approach consists of a cshtml file and a cshtml.cs file (by design, the two files have the same name).

You can seamlessly integrate the Telerik UI PivotGridV2 for ASP.NET Core in Razor Pages applications.

This article describes how to configure the PivotGridV2 component in a Razor Pages scenario.

Getting Started

The following example demonstrates how to configure the PivotGridV2 DataSource for Ajax data binding to an Online Analytical Processing (OLAP) cube within a Razor Pages application.

  • Add the OLAP service dll (https://demos.telerik.com/olap/msmdpump.dll) as a Read request URL in the DataSource configuration to bind the PivotGridV2 to data over an OLAP cube. Since the data is requested from the online accessible OLAP service, it is not required to send the anti-forgery token with the POST request.

  • Define the desired initial rows, columns and measures in the DataSource.

    HtmlHelper_Index.cshtml
        @page
        @model IndexModel
        @using Kendo.Mvc.UI
    
        @(Html.Kendo().PivotGridV2()
            .Name("pivotgrid")
            .ColumnWidth(200)
            .Height(580)
            .DataSource(dataSource => dataSource.
                Xmla()
                .Columns(columns => {
                    columns.Add("[Date].[Calendar]").Expand(true);
                    columns.Add("[Product].[Category]");
                })
                .Rows(rows => rows.Add("[Geography].[City]").Expand(true))
                .Measures(measures => measures.Values(new string[]{"[Measures].[Reseller Freight Cost]"}))
                .Transport(transport => transport
                    .Connection(connection => connection
                        .Catalog("Adventure Works DW 2008R2")
                        .Cube("Adventure Works"))
                    .Read("https://demos.telerik.com/olap/msmdpump.dll")
                )
            )
        )

See Also

In this article
Getting StartedSee Also
Not finding the help you need?
Contact Support