Edit this page

PivotGrid HtmlHelper Overview

The PivotGrid HtmlHelper extension is a server-side wrapper for the Kendo UI PivotGrid widget. It allows you to configure the Kendo UI PivotGrid from server-side code and helps you with data binding.

Getting Started

The Basics

The Kendo UI PivotGrid for ASP.NET MVC supports Ajax data-binding to HTTP accessible OLAP cube.

For more information on the OLAP concepts, refer to the articles about:

To use Telerik OLAP service, refer to http://demos.telerik.com/olap/msmdpump.dll.

The Kendo UI PivotGrid for ASP.NET MVC also supports server and Ajax data-binding to a flat data. The widget creates a client-side cube allowing to categorize the flat data.

For more information, refer to the demos on:

Configuration

Below are listed the steps for you to follow when configuring the Kendo UI PivotGrid for ASP.NET MVC and doing Ajax binding to an Adventure Works cube, hosted on http://demos.telerik.com/olap/msmdpump.dll.

  1. Create a new ASP.NET MVC 4 application. If you have the Telerik UI for ASP.NET MVC Visual Studio Extensions installed, create a Telerik UI for ASP.NET MVC application. Name the application KendoPivotGrid. If you decide not to use the Telerik UI for ASP.NET MVC Visual Studio Extensions, follow the steps from the introductory article to add Telerik UI for ASP.NET MVC to the application.

  2. Add a Kendo UI PivotGrid to the Index view.

    Example
    
          <%: Html.Kendo().PivotGrid()
                  .Name("pivotgrid")
                  .DataSource(dataSource => dataSource.
                      Xmla()
                      .Columns(columns => {
                          columns.Add("[Date].[Calendar]").Expand(true);
                          columns.Add("[Geography].[City]");
                      })
                      .Rows(rows => rows.Add("[Product].[Product]"))
                      .Measures(measures => measures.Values(new string[]{"[Measures].[Internet Sales Amount]"}))
                      .Transport(transport => transport
                          .Connection(connection => connection
                              .Catalog("Adventure Works DW 2008R2")
                              .Cube("Adventure Works"))
                          .Read(read => read
                              .Url("http://demos.telerik.com/olap/msmdpump.dll")
                              .DataType("text")
                              .ContentType("text/xml")
                              .Type(HttpVerbs.Post)
                          )
                      )
                  )
          %>
    
    
          @(Html.Kendo().PivotGrid()
                .Name("pivotgrid")
                .DataSource(dataSource => dataSource.
                    Xmla()
                    .Columns(columns => {
                        columns.Add("[Date].[Calendar]").Expand(true);
                        columns.Add("[Geography].[City]");
                    })
                    .Rows(rows => rows.Add("[Product].[Product]"))
                    .Measures(measures => measures.Values(new string[]{"[Measures].[Internet Sales Amount]"}))
                    .Transport(transport => transport
                        .Connection(connection => connection
                            .Catalog("Adventure Works DW 2008R2")
                            .Cube("Adventure Works"))
                        .Read(read => read
                            .Url("http://demos.telerik.com/olap/msmdpump.dll")
                            .DataType("text")
                            .ContentType("text/xml")
                            .Type(HttpVerbs.Post)
                        )
                    )
                )
          )
    
  3. Build and run the application.

    Figure 1. The finished application

    Final result

See Also