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

Declarative Binding

SQLDataSource

empty
QuantityShipCountryYear
CategoryNameProductName
empty
GermanyGermany Total USAUSA TotalGrand Total
199619971998199619971998
empty
BeveragesChartreuse verte
Côte de Blaye
Guaraná Fantástica
Ipoh Coffee
Lakkalikööri
Laughing Lumberjack Lager
Outback Lager
Rhönbräu Klosterbier
Sasquatch Ale
Steeleye Stout
Grand Total
empty
5836801743010 40214
 3090120205595170290
 435093 187997190
2455241031524 39142
2778134239 12050170409
525 30 10 1040
 792099 15621120
2285491566167120293449
 30 30 8735122152
 3043731003935174247
1064427522227561115843552673818615747
Page size:

ObjectDataSource

empty
PassengersCargoCountryCity
PlaneTypePlaneModel
empty
GermanyGermany Sum of PassengersGermany Sum of Cargo UKUK Sum of PassengersUK Sum of CargoTotal Sum of PassengersTotal Sum of Cargo
BerlinMunchenLondonManchester
Sum of PassengersSum of CargoSum of PassengersSum of CargoSum of PassengersSum of CargoSum of PassengersSum of Cargo
empty
AirbusA320
A340
Airbus Total
Boeing737
747
Boeing Total
EmbraerE170
E190
Embraer Total
Grand Total
empty
1101115015260263037071001036036
220223003052052606140142002072072
33033450457807890921021300301080108
33033450457807890921021300301080108
440446006010401041201228028400401440144
77077105010518201822102149049700702520252
440666009010401561201828042400601440216
3305545075780130901521035300501080180
7701211050165182028621033490777001102520396
18702312550315442054651063119014717002106120756
1
Page size:

RadPivotGrid can be bound to all ASP 2.0 DataSource control types:

  • SQLDataSource
  • ObjectDataSource

All you need to do is set the DataSourceID property of the pivot grid to the ID of the datasource control and you are ready to use the provided data.

  • DefaultVB.aspx
<%@ Page Language="VB"  %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="RadAjaxLoadingPanel1">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadPivotGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadPivotGrid1"></telerik:AjaxUpdatedControl>
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="RadPivotGrid2">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadPivotGrid2"></telerik:AjaxUpdatedControl>
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
    </telerik:RadAjaxLoadingPanel>
    <div class="demo-container no-bg">
        <h2 class="qsfSubtitle">SQLDataSource
        </h2>
        <telerik:RadPivotGrid RenderMode="Lightweight" ID="RadPivotGrid1" runat="server" DataSourceID="SqlDataSource1" Height="370px"
            AllowPaging="true" AllowFiltering="false" ShowFilterHeaderZone="false">
            <ClientSettings Scrolling-AllowVerticalScroll="true">
            </ClientSettings>
            <DataCellStyle Width="100px" />
            <Fields>
                <telerik:PivotGridColumnField DataField="ShipCountry">
                </telerik:PivotGridColumnField>
                <telerik:PivotGridColumnField DataField="Year">
                </telerik:PivotGridColumnField>
                <telerik:PivotGridRowField DataField="CategoryName">
                </telerik:PivotGridRowField>
                <telerik:PivotGridRowField DataField="ProductName">
                </telerik:PivotGridRowField>
                <telerik:PivotGridAggregateField DataField="Quantity" Aggregate="Sum">
                </telerik:PivotGridAggregateField>
            </Fields>
        </telerik:RadPivotGrid>
        <br />
        <h2 class="qsfSubtitle">ObjectDataSource
        </h2>
        <telerik:RadPivotGrid RenderMode="Lightweight" ID="RadPivotGrid2" runat="server" DataSourceID="ObjectDataSource1" Height="370px"
            AllowPaging="true" AllowFiltering="false" ShowFilterHeaderZone="false">
            <ClientSettings Scrolling-AllowVerticalScroll="true">
            </ClientSettings>
            <DataCellStyle Width="100px" />
            <Fields>
                <telerik:PivotGridRowField ZoneIndex="0" DataField="PlaneType" Caption="PlaneType">
                </telerik:PivotGridRowField>
                <telerik:PivotGridRowField ZoneIndex="1" DataField="PlaneModel" Caption="PlaneModel">
                </telerik:PivotGridRowField>
                <telerik:PivotGridAggregateField ZoneIndex="0" DataField="Passengers" Caption="Passengers"
                    UniqueName="Passengers" Aggregate="Sum">
                </telerik:PivotGridAggregateField>
                <telerik:PivotGridAggregateField ZoneIndex="1" DataField="Cargo" Caption="Cargo"
                    UniqueName="Cargo" Aggregate="Sum">
                </telerik:PivotGridAggregateField>
                <telerik:PivotGridColumnField ZoneIndex="0" DataField="Country" Caption="Country"
                    UniqueName="Country">
                </telerik:PivotGridColumnField>
                <telerik:PivotGridColumnField ZoneIndex="1" DataField="City" Caption="City" UniqueName="City">
                </telerik:PivotGridColumnField>
            </Fields>
        </telerik:RadPivotGrid>
        <br />
        <asp:SqlDataSource ID="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
            SelectCommand="SELECT [ProductID], [ProductName], [ShipCountry], [CategoryName], [Year], [Quantity] FROM [Product Reports Comparison]"
            runat="server"></asp:SqlDataSource>
        <asp:ObjectDataSource ID="ObjectDataSource1" runat="server" SelectMethod="GetPivotData"
            TypeName="Telerik.Web.Examples.PivotItemData"></asp:ObjectDataSource>
    </div>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance