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

Client-Side API

empty
Drop Filter Fields Here
TotalPriceQuantityYearQuarter
CategoryProductName
empty
19971997 Sum of TotalPrice1997 Sum of Quantity 19981998 Sum of TotalPrice1998 Sum of QuantityTotal Sum of TotalPriceTotal Sum of Quantity
Quarter 1Quarter 2Quarter 3Quarter 4Quarter 1Quarter 2
Sum of TotalPriceSum of QuantitySum of TotalPriceSum of QuantitySum of TotalPriceSum of QuantitySum of TotalPriceSum of QuantitySum of TotalPriceSum of QuantitySum of TotalPriceSum of Quantity
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
$662.4046$450.0025$1,152.0064$2,664.00148$4,928.40283$3,996.00222$360.0020$4,356.00242$9,284.40525
$27,193.20129$16,864.0064$3,952.5015$3,952.5015$51,962.20223$61,922.50235$6,587.5025$68,510.00260$120,472.20483
$550.80153$675.00150$351.0078$180.0040$1,756.80421$1,737.00386$720.00160$2,457.00546$4,213.80967
$1,398.4038$4,600.00100$4,140.0090$1,380.0030$11,518.40258$4,140.0090$4,416.0096$8,556.00186$20,074.40444
$1,353.6094$3,744.00208$2,610.00145EmptyEmpty$7,707.60447$4,320.00240$2,664.00148$6,984.00388$14,691.60835
EmptyEmpty$518.0037$350.0025$42.003$910.0065$1,316.0094$280.0020$1,596.00114$2,506.00179
$1,260.00105$630.0042$3,465.00231$525.0035$5,880.00413$2,685.00179$1,035.0069$3,720.00248$9,600.00661
$458.8074$2,418.00312$984.25127$906.75117$4,767.80630$2,875.25371$232.5030$3,107.75401$7,875.551031
$616.0055$700.0050$784.0056$140.0010$2,240.00171$420.0030$3,010.00215$3,430.00245$5,670.00416
$1,483.20103$2,394.00133$1,710.0095$270.0015$5,857.20346$2,628.00146$2,106.00117$4,734.00263$10,591.20609
$135,283.405594$182,124.826635$189,623.977447$68,321.012267$575,353.2021943$266,773.928290$132,342.474469$399,116.3912759$974,469.5934702
Page size:
  • Refresh
  • Hide
  • Summarize By Settings
  • Show Fields Window
Event log

  • Expand
  • Collapse
  • Demo Configurator

The demo showcases various techniques involving the RadPivotGrid Client-Side API. It is very easy to access cells, zones, subscribe to events, perform paging, sorting and expand\collapse operations.

The functionalities implemented using the API are listed below:

  • The paging section shows how you could externally page the pivot using custom design and using different controls.
  • The sorting section shows how simple is to sort the pivot data.
  • If you take a look at the event log below the PivotGrid you could observe of each of the control interactions events are fired which could be handled and custom logic implemented. For example if you click one of the cells it will highlight and show which value you are currently looking at.
  • Another little addition just to showcase the possibilities the API provides - is right clicking a cell which contains a expand\collapse button a context menu shows which gives you the option to expand and collapse using the menu.
  • DefaultCS.aspx
  • DefaultCS.aspx.cs
  • Scripts.js
  • Styles.css
<%@ Page Language="c#" AutoEventWireup="false" CodeFile="DefaultCS.aspx.cs" Inherits="Telerik.GridExamplesCSharp.FirstLook.DefaultCS" %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.QuickStart" %>
<%@ 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>
    <link rel="Stylesheet" type="text/css" href="styles.css" />
    <script type="text/javascript" src="scripts.js"></script>
</head>
<body>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
<div class="demo-container no-bg">
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server">
    </telerik:RadAjaxLoadingPanel>
    <telerik:RadAjaxPanel ID="radAjaxPanel1" runat="server" LoadingPanelID="RadAjaxLoadingPanel1">
        <telerik:RadPivotGrid RenderMode="Lightweight" ID="RadPivotGrid1" runat="server" AllowPaging="true" PageSize="10"
            Height="500px" ColumnHeaderZoneText="ColumnHeaderZone" EnableZoneContextMenu="true"
            AllowSorting="true" EmptyValue="Empty" ErrorValue="Error" OnNeedDataSource="RadPivotGrid1_NeedDataSource">
            <PagerStyle AlwaysVisible="false" />
            <ClientSettings>
                <Scrolling AllowVerticalScroll="true"></Scrolling>
                <ClientEvents OnPivotGridCreated="demo.PivotGridCreated" OnCellClick="demo.CellClick" OnCellMouseOver="demo.CellMouseOver"
                    OnCellMouseOut="demo.CellMouseOut" OnCellContextMenu="demo.CellContextMenu" OnCellDoubleClick="demo.CellDoubleClick"
                    OnMenuShown="demo.MenuShown" OnMenuShowing="demo.MenuShowing" />
            </ClientSettings>
            <Fields>
                <telerik:PivotGridRowField DataField="Category" ZoneIndex="0">
                </telerik:PivotGridRowField>
                <telerik:PivotGridRowField DataField="ProductName" ZoneIndex="1">
                </telerik:PivotGridRowField>
                <telerik:PivotGridColumnField DataField="Year">
                </telerik:PivotGridColumnField>
                <telerik:PivotGridColumnField DataField="Quarter" DataFormatString="Quarter {0}">
                </telerik:PivotGridColumnField>
                <telerik:PivotGridAggregateField DataField="TotalPrice" Aggregate="Sum" DataFormatString="{0:C}">
                </telerik:PivotGridAggregateField>
                <telerik:PivotGridAggregateField DataField="Quantity" Aggregate="Sum">
                </telerik:PivotGridAggregateField>
            </Fields>
            <SortExpressions>
                <telerik:PivotGridSortExpression FieldName="TotalPrice" SortOrder="Descending"></telerik:PivotGridSortExpression>
            </SortExpressions>
        </telerik:RadPivotGrid>
        <qsf:EventLogConsole runat="server" ID="EventLogConsole1" CssClass="eventLog" Height="400px"
            Width="100%"></qsf:EventLogConsole>
        <br class="qsf-clear-float" />
        <telerik:RadContextMenu runat="server" ID="RadContextMenuExpandCollapse" OnClientItemClicked="demo.ItemClicked">
            <Items>
                <telerik:RadMenuItem Text="Expand" Value="Expand">
                </telerik:RadMenuItem>
                <telerik:RadMenuItem Text="Collapse" Value="Collapse">
                </telerik:RadMenuItem>
            </Items>
        </telerik:RadContextMenu>
    </telerik:RadAjaxPanel>
    </div>
    <telerik:ConfiguratorPanel runat="server" ID="ConfiguratorPanel1">
        <Views>
            <qsf:View Title="Paging">
                <qsf:ConfiguratorColumn runat="server" Size="Narrow">
                    <qsf:Button runat="server" Text="First" ID="ButtonFirstPage" AutoPostBack="false" OnClientClick="demo.GoToFirstPage" />
                    <qsf:Button runat="server" ID="ButtonPreviousPage" Text="Prev" AutoPostBack="false" OnClientClick="demo.GoToPreviousPage" />
                </qsf:ConfiguratorColumn>
                <qsf:ConfiguratorColumn ID="ConfiguratorColumn1" runat="server" Size="Medium">
                    <ul class="fb-group">
                        <li>
                            <qsf:NumericTextBox ID="RadNumericTextBoxCurrentPage" Size="Medium"
                                runat="server" Value="1" Label="Current page:" ShowSpinButtons="true"
                                MinValue="1">
                                <NumberFormat DecimalDigits="0" />
                                <ClientEvents OnValueChanged="demo.CurrentPageValueChanged" />
                            </qsf:NumericTextBox>
                            <qsf:NumericTextBox ID="RadNumericTextBoxPageSize"
                                runat="server" Value="10" MinValue="1" Size="Medium"
                                ShowSpinButtons="true" Label="PageSize:">
                                <NumberFormat DecimalDigits="0" />
                                <ClientEvents OnValueChanged="demo.PageSizeValueChanged" />
                            </qsf:NumericTextBox>
                        </li>
                    </ul>
                </qsf:ConfiguratorColumn>
                <qsf:ConfiguratorColumn ID="ConfiguratorColumn2" runat="server" Size="Narrow">
                    <qsf:Button runat="server" Text="Next" ID="ButtonNextPage" AutoPostBack="false" OnClientClicked="demo.GoToNextPage" />
                    <qsf:Button runat="server" Text="Last" ID="ButtonLastPage" AutoPostBack="false" OnClientClicked="demo.GoToLastPage" />
                </qsf:ConfiguratorColumn>
            </qsf:View>
            <qsf:View Title="Sorting">
                <ul class="fb-group">
                    <li>
                        <qsf:ComboBox runat="server" ID="RadComboBox1" OnClientLoad="demo.OnLoad" Size="Medium" Label="Select field to sort">
                        </qsf:ComboBox>
                        <qsf:Button ID="Button1" runat="server" Text="Sort" AutoPostBack="false" OnClientClicked="demo.Sort" />
                    </li>
                </ul>
            </qsf:View>
        </Views>
    </telerik:ConfiguratorPanel>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance