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

Declarative Data Source

RadPivotGrid can seamlessly be bound to native data source controls, these being:

  • SqlDataSource

  • ObjectDataSource

  • EntityDataSource

  • LinqDataSource

The only thing needed once you set up the data source control is to set the pivot grid's DataSourceID property to point to the datasource's ID. From there on, all that is left is to specify the fields that you want to appear as columns and those that should come as rows, as well as the fields that you need to display aggregates for.

A sample RadPivotGrid declaration, using an EntityDataSource is shown below:

<telerik:RadPivotGrid RenderMode="Lightweight" ID="RadPivotGrid2" runat="server" DataSourceID="EntityDataSource1"
<ClientSettings Scrolling-AllowVerticalScroll="true">>
<telerik:PivotGridColumnField DataField="ShipCountry">
<telerik:PivotGridColumnField DataField="Year">
<telerik:PivotGridRowField DataField="CategoryName">
<telerik:PivotGridRowField DataField="ProductName">
<telerik:PivotGridAggregateField DataField="Quantity" Aggregate="Sum">
<asp:EntityDataSource ID="EntityDataSource1" runat="server" ConnectionString="name=NorthwindEntities"
DefaultContainerName="NorthwindEntities" EnableFlattening="False" EntitySetName="Product_Reports_Comparisons">
In this article