ClientDataSource - Grouping

Isolate this demo as a stand-alone application
  • About this demo
  • C#
  • VB
The demo shows how to apply group setting to the data source and retrieve the grouped data. This is done through the GroupExpressions collection:
<GroupExpressions>
   <telerik:ClientDataSourceGroupExpressionFieldName="Name"SortOrder="Asc">
   </telerik:ClientDataSourceGroupExpression>
</GroupExpressions>
  • DefaultCS.aspx
  • scripts.js
  • styles.css
<%@ Page Language="C#" AutoEventWireup="true"  %>

<%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %>
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <link href="styles.css" rel="stylesheet" />
    <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-containers">
        <div class="demo-container">
            <telerik:RadCodeBlock runat="server" ID="RadCodeBlock1">
                <script type="text/javascript">
                    var dataSource;
                    Sys.Application.add_load(function () {
                        dataSource = $find('<%= RadClientDataSource1.ClientID %>');
                    });
                </script>
            </telerik:RadCodeBlock>
            <telerik:RadClientDataSource runat="server" ID="RadClientDataSource1">
                <DataSource>
                    <WebServiceDataSourceSettings ServiceType="OData">
                        <Select Url="http://demos.telerik.com/aspnet-ajax/Services/SampleODataService.svc/Products" />
                    </WebServiceDataSourceSettings>
                </DataSource>
                <Schema>
                    <Model ID="ProductID">
                        <telerik:ClientDataSourceModelField FieldName="ProductName" DataType="String" />
                        <telerik:ClientDataSourceModelField FieldName="UnitPrice" DataType="Number" />
                        <telerik:ClientDataSourceModelField FieldName="Category" DataType="String" />
                    </Model>
                </Schema>
                <GroupExpressions>
                    <telerik:ClientDataSourceGroupExpression FieldName="Category">
                        <Aggregates>
                            <telerik:ClientDataSourceAggregate Aggregate="Sum" Field="UnitPrice" />
                        </Aggregates>
                    </telerik:ClientDataSourceGroupExpression>
                </GroupExpressions>
                <ClientEvents OnChange="dataSourceChange" />
            </telerik:RadClientDataSource>
            <div class="demo-section">
            </div>
        </div>
    </div>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance

Help Us Improve

Was this example helpful?