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

PivotGridBuilder

Methods

AutoBind(System.Boolean)

If set to false the initial binding will be prevented.

Parameters

autoBind - System.Boolean

The autoBind

Configurator(System.String)

Use it to set the Id of the PivotConfigurator.

Parameters

configurator - System.String

The configurator

ColumnWidth(System.Int32)

Use it to set the column width of the Pivot.

Parameters

columnWidth - System.Int32

The column width.

Height(System.Int32)

Use it to set the height of the Pivot.

Parameters

height - System.Int32

The height

Excel(System.Action)

Configures the Excel export settings.

Parameters

configurator - System.Action<PivotGridExcelBuilder>

Example


            @(Html.Kendo().PivotGrid()
                .Name("pivotgrid")
                .Excel(excel => excel.FileName("PivotGridExport.xlsx"))
            )

Pdf(System.Action)

Configures the PDF export settings.

Parameters

configurator - System.Action<PDFSettingsBuilder>

Example


            @(Html.Kendo().PivotGrid()
                .Name("pivotgrid")
                .Pdf(pdf => pdf.FileName("PivotGridExport.pdf"))
            )

Reorderable(System.Boolean)

If set to false the user will not be able to add/close/reorder current fields for columns/rows/measures.

Parameters

reorderable - System.Boolean

The reorderable

Filterable(System.Boolean)

If set to true the user will be able to filter by using the field menu.

Parameters

filterable - System.Boolean

The filterable

Sortable()

Enables grid column sorting.

Example


            @(Html.Kendo().PivotGrid()
                  .Name("pivotgrid")
                  .Sortable()
                  .DataSource(dataSource =>
                    dataSource.Xmla()
                       .Columns(columns => columns.Add("[Date].[Calendar]").Expand(true))
                       .Rows(rows => rows.Add("[Geography].[City]"))
                       .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)
                           )
                       )
                  )
            )

Sortable(System.Action)

Sets the sorting configuration of the pivotgrid.

Parameters

configurator - System.Action<PivotGridSortSettingsBuilder>

The lambda which configures the sorting

Example


            @(Html.Kendo().PivotGrid()
                  .Name("pivotgrid")
                  .Sortable(sorting => sorting.AllowUnsort(true))
                  .DataSource(dataSource =>
                    dataSource.Xmla()
                       .Columns(columns => columns.Add("[Date].[Calendar]").Expand(true))
                       .Rows(rows => rows.Add("[Geography].[City]"))
                       .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)
                           )
                       )
                  )
            )

Events(System.Action)

Configures the client-side events

Parameters

configurator - System.Action<PivotGridEventBuilder>

DataSource(System.Action)

Sets the data source configuration of the grid.

Parameters

configurator - System.Action<PivotDataSourceBuilder>

The lambda which configures the data source

DataSource(System.String)

Parameters

dataSourceId - System.String

BindTo(System.Collections.Generic.IEnumerable)

Binds the pivotGrid to a list of objects

Parameters

dataSource - System.Collections.Generic.IEnumerable<TModel>

The data source.

Messages(System.Action)

Sets the messages of the pivotGrid.

Parameters

addViewAction - System.Action<PivotGridMessagesBuilder>

The lambda which configures the pivotGrid messages

DataCellTemplate(System.String)

Sets the data cell template of the pivot grid.

Parameters

template - System.String

The template

Example

 ")
                  .DataSource(dataSource =>
                    dataSource.Xmla()
                       .Columns(columns => columns.Add("[Date].[Calendar]").Expand(true))
                       .Rows(rows => rows.Add("[Geography].[City]"))
                       .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)
                           )
                       )
                   )
               )

DataCellTemplateId(System.String)

Sets the data cell template of the pivot grid.

Parameters

templateId - System.String

The template id

Example


            @(Html.Kendo().PivotGrid()
                  .Name("pivotgrid")
                  .DataCellTemplateId("dataCellTemplateId")
                  .DataSource(dataSource =>
                    dataSource.Xmla()
                       .Columns(columns => columns.Add("[Date].[Calendar]").Expand(true))
                       .Rows(rows => rows.Add("[Geography].[City]"))
                       .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)
                           )
                       )
                   )
               )

DataCellTemplateView(System.Web.Mvc.MvcHtmlString)

Sets the data cell template of the pivot grid.

Parameters

template - System.Web.Mvc.MvcHtmlString

The view template

Example


            @(Html.Kendo().PivotGrid()
                  .Name("pivotgrid")
                  .DataCellTemplateView(Html.Partial("data-cell-template"))
                  .DataSource(dataSource =>
                    dataSource.Xmla()
                       .Columns(columns => columns.Add("[Date].[Calendar]").Expand(true))
                       .Rows(rows => rows.Add("[Geography].[City]"))
                       .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)
                           )
                       )
                   )
               )

DataCellTemplateHandler(System.String)

Parameters

template - System.String

KPIStatusTemplate(System.String)

Sets the KPI Status template of the pivot grid.

Parameters

template - System.String

The template

Example

 ")
                  .DataSource(dataSource =>
                    dataSource.Xmla()
                       .Columns(columns => columns.Add("[Date].[Calendar]").Expand(true))
                       .Rows(rows => rows.Add("[Geography].[City]"))
                       .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)
                           )
                       )
                   )
               )

KPIStatusTemplateId(System.String)

Sets the KPI Status template of the pivot grid.

Parameters

templateId - System.String

The template id

Example


            @(Html.Kendo().PivotGrid()
                  .Name("pivotgrid")
                  .KPIStatusTemplateId("kpiStatusTemplateId")
                  .DataSource(dataSource =>
                    dataSource.Xmla()
                       .Columns(columns => columns.Add("[Date].[Calendar]").Expand(true))
                       .Rows(rows => rows.Add("[Geography].[City]"))
                       .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)
                           )
                       )
                   )
               )

KPIStatusTemplateView(System.Web.Mvc.MvcHtmlString)

Sets the KPI Status template of the pivot grid.

Parameters

template - System.Web.Mvc.MvcHtmlString

The view template

Example


            @(Html.Kendo().PivotGrid()
                  .Name("pivotgrid")
                  .KPIStatusTemplateView(Html.Partial("kpis-template"))
                  .DataSource(dataSource =>
                    dataSource.Xmla()
                       .Columns(columns => columns.Add("[Date].[Calendar]").Expand(true))
                       .Rows(rows => rows.Add("[Geography].[City]"))
                       .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)
                           )
                       )
                   )
               )

KPIStatusTemplateHandler(System.String)

Parameters

template - System.String

KPITrendTemplate(System.String)

Sets the KPI Trend template of the pivot grid.

Parameters

template - System.String

The template

Example

 ")
                  .DataSource(dataSource =>
                    dataSource.Xmla()
                       .Columns(columns => columns.Add("[Date].[Calendar]").Expand(true))
                       .Rows(rows => rows.Add("[Geography].[City]"))
                       .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)
                           )
                       )
                   )
               )

KPITrendTemplateId(System.String)

Sets the KPI Trend template of the pivot grid.

Parameters

templateId - System.String

The template id

Example


            @(Html.Kendo().PivotGrid()
                  .Name("pivotgrid")
                  .KPITrendTemplateId("kpiTrendTemplateId")
                  .DataSource(dataSource =>
                    dataSource.Xmla()
                       .Columns(columns => columns.Add("[Date].[Calendar]").Expand(true))
                       .Rows(rows => rows.Add("[Geography].[City]"))
                       .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)
                           )
                       )
                   )
               )

KPITrendTemplateView(System.Web.Mvc.MvcHtmlString)

Sets the KPI Trend template of the pivot grid.

Parameters

template - System.Web.Mvc.MvcHtmlString

The template

Example


            @(Html.Kendo().PivotGrid()
                  .Name("pivotgrid")
                  .KPITrendTemplateView(Html.Partial("kpi-trend-template"))
                  .DataSource(dataSource =>
                    dataSource.Xmla()
                       .Columns(columns => columns.Add("[Date].[Calendar]").Expand(true))
                       .Rows(rows => rows.Add("[Geography].[City]"))
                       .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)
                           )
                       )
                   )
               )

KPITrendTemplateHandler(System.String)

Parameters

template - System.String

ColumnHeaderTemplate(System.String)

Sets the column header cell template of the pivot grid.

Parameters

template - System.String

The template

Example

 ")
                  .DataSource(dataSource =>
                    dataSource.Xmla()
                       .Columns(columns => columns.Add("[Date].[Calendar]").Expand(true))
                       .Rows(rows => rows.Add("[Geography].[City]"))
                       .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)
                           )
                       )
                   )
               )

ColumnHeaderTemplateId(System.String)

Sets the column header cell template of the pivot grid.

Parameters

templateId - System.String

The template id

Example


            @(Html.Kendo().PivotGrid()
                  .Name("pivotgrid")
                  .ColumnHeaderTemplateId("columnHeaderTemplateId")
                  .DataSource(dataSource =>
                    dataSource.Xmla()
                       .Columns(columns => columns.Add("[Date].[Calendar]").Expand(true))
                       .Rows(rows => rows.Add("[Geography].[City]"))
                       .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)
                           )
                       )
                   )
               )

ColumnHeaderTemplateView(System.Web.Mvc.MvcHtmlString)

Sets the column header cell template of the pivot grid.

Parameters

template - System.Web.Mvc.MvcHtmlString

The view template

Example


            @(Html.Kendo().PivotGrid()
                  .Name("pivotgrid")
                  .ColumnHeaderTemplateView(Html.Partial("header-template"))
                  .DataSource(dataSource =>
                    dataSource.Xmla()
                       .Columns(columns => columns.Add("[Date].[Calendar]").Expand(true))
                       .Rows(rows => rows.Add("[Geography].[City]"))
                       .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)
                           )
                       )
                   )
               )

ColumnHeaderTemplateHandler(System.String)

Parameters

template - System.String

RowHeaderTemplate(System.String)

Sets the row header cell template of the pivot grid.

Parameters

template - System.String

The template

Example

 ")
                  .DataSource(dataSource =>
                    dataSource.Xmla()
                       .Columns(columns => columns.Add("[Date].[Calendar]").Expand(true))
                       .Rows(rows => rows.Add("[Geography].[City]"))
                       .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)
                           )
                       )
                   )
               )

RowHeaderTemplateId(System.String)

Sets the row header cell template of the pivot grid.

Parameters

templateId - System.String

The template id

Example


            @(Html.Kendo().PivotGrid()
                  .Name("pivotgrid")
                  .RowHeaderTemplateId("rowHeaderTemplateId")
                  .DataSource(dataSource =>
                    dataSource.Xmla()
                       .Columns(columns => columns.Add("[Date].[Calendar]").Expand(true))
                       .Rows(rows => rows.Add("[Geography].[City]"))
                       .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)
                           )
                       )
                   )
               )

RowHeaderTemplateView(System.Web.Mvc.MvcHtmlString)

Sets the row header cell template of the pivot grid.

Parameters

template - System.Web.Mvc.MvcHtmlString

The view template

Example


            @(Html.Kendo().PivotGrid()
                  .Name("pivotgrid")
                  .RowHeaderTemplateView(Html.Partial("header-template"))
                  .DataSource(dataSource =>
                    dataSource.Xmla()
                       .Columns(columns => columns.Add("[Date].[Calendar]").Expand(true))
                       .Rows(rows => rows.Add("[Geography].[City]"))
                       .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)
                           )
                       )
                   )
               )

RowHeaderTemplateHandler(System.String)

Parameters

template - System.String

ToComponent()

Returns the internal view component.

Name(System.String)

Sets the name of the component.

Parameters

componentName - System.String

The name of the component.

Example


            @(Html.Kendo().Grid<OrderViewModel>()
               .Name("grid")
               .Columns(columns =>
               {
                   columns.Bound(p => p.OrderID).Filterable(false);
                   columns.Bound(p => p.Freight);
               })
               .DataSource(dataSource => dataSource
                   .Ajax()
                   .PageSize(20)
                   .Read(read => read.Action("Orders_Read", "Grid"))
               )
            )

Deferred(System.Boolean)

Suppress initialization script rendering. Note that this options should be used in conjunction with

Parameters

deferred - System.Boolean

ModelMetadata(System.Web.Mvc.ModelMetadata)

Uses the Metadata of the Model.

Parameters

modelMetadata - System.Web.Mvc.ModelMetadata

The metadata set for the Model

HtmlAttributes(System.Object)

Sets the HTML attributes.

Parameters

attributes - System.Object

The HTML attributes.

HtmlAttributes(System.Collections.Generic.IDictionary)

Parameters

attributes - System.Collections.Generic.IDictionary<String,Object>

AsModule(System.Boolean)

Specifies whether the initialization script of the component will be rendered as a JavaScript module.

Parameters

value - System.Boolean

Render()

Renders the component.

Example


            @(@Page Inherits="System.Web.Mvc.ViewPage<IEnumerable<Product>>" )
            @( Html.Kendo().Grid(Model)
                .Name("grid")
                .DetailTemplate(product => {
                    )
                       Product Details:
                       <div>Product Name: @( product.ProductName )</div>
                       <div>Units In Stock: @( product.UnitsInStock )</div>
                    @(
                })
                .Render();
            )

ScriptAttributes(System.Object,System.Boolean)

Sets the JavaScript attributes to the initialization script.

Parameters

attributes - System.Object

The JavaScript attributes.

overrideAttributes - System.Boolean

Argument which determines whether attributes should be overriden.

ScriptAttributes(System.Collections.Generic.IDictionary,System.Boolean)

Sets the JavaScript attributes to the initialization script.

Parameters

attributes - System.Collections.Generic.IDictionary<String,Object>

The JavaScript attributes.

overrideAttributes - System.Boolean

Argument which determines whether attributes should be overriden.

ToHtmlString()

ToClientTemplate()

In this article
Not finding the help you need?