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

Binding to Telerik ClientDataSource

Page 1 of 10


By Price:

By units in Stock:


  • Units In Stock
  • Name
  • Unit Price

This demo illustrates how you can bind RadListView to RadClientDataSource

It demonstrates how to use the client-side API of the TreeList to achieve multiple column sorting, range filtering, and paging with using the client side API of RadListView .


The between filter expression is not built-in for the RadTreeList, but can be implemented by applying two filter expressions on the same field. This approach is supported by both RadListView and RadClientDataSource. Here is an example how to add "between" filter for "ProductID" field:

         listView1.get_filterExpressions().add("ProductID", "GreaterThan", 5);        
         listView1.get_filterExpressions().add("ProductID", "LessThan", 10);         


In this demo we use two RadSlider controls with enabled range selection to select minimum and maximum values for the "UnitPrice" and "UnitsInStock" fields.


Multiple field sorting is also supported by both controls. To enable it you have to set AllowMultiFieldSorting="true" in the declaration of your RadListView. In this demo the sort expressions used for the ListView are created based on the values (and their order) shown in a ListBox. It has enabled drag drop and reorder functionality to allow reordering its items. Item order in the ListBox will determine the fields sort expressions order of the ListView. Each of the items of the ListBox has two states corresponding to ascending and descending order.

If you want to sort "Units In Stock" and "Unit Price", drag the "Units In Stock" item at the top of the ListBox and then drag the "Unit Price" at the second place. If you want to change the sort order of given field, click on the sorting icon in the given item of the ListBox. Here is example code that can be used for adding sorting on two fields. Records that have equal values by the first field, will be sorted by the second field in particular order.

        listView1.get_sortExpressions().add("UnitPrice", "Asc");         
        listView1.get_sortExpressions().add("ProductName", "Desc");     


To enable the paging the AllowPaging property of the RadTreeList should be set to "true". To navigate to given page it is enough to call:

  • DefaultCS.aspx
  • DefaultCS.aspx.cs
  • scripts.js
  • styles.css
<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="DefaultCS.aspx.cs"
    Inherits="Telerik.ListViewExamplesCSharp.Client.ClientDataSourceBinding.DefaultCS" %>

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

<!DOCTYPE html>
<html xmlns=''>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <link href="styles.css" rel="stylesheet" />
    <script type="text/javascript" src="scripts.js"></script>
    <form id="form1" runat="server">
    <telerik:RadScriptManager runat="server" ID="RadScriptManager1" />
    <telerik:RadSkinManager ID="RadSkinManager1" runat="server" ShowChooser="true" />
    <script type="text/javascript">
        function pageLoad() {
                "<%= RadListView1.ClientID%>",
                "<%= pageSlider.ClientID%>",
                "<%= priceSlider.ClientID%>",
                "<%= stockSlider.ClientID%>",
                "<%= RadListBox1.ClientID%>",
                "<%= PagerLabel.ClientID%>");
    <telerik:RadFormDecorator RenderMode="Lightweight" ID="RadFormDecorator1" runat="server" DecoratedControls="All" ControlsToSkip="H4H5H6" />
    <telerik:RadClientDataSource ID="RadClientDataSource1" runat="server">
            <WebServiceDataSourceSettings ServiceType="OData">
                <Select Url="" DataType="JSONP" />
                <telerik:ClientDataSourceModelField FieldName="ProductName" DataType="String" />
                <telerik:ClientDataSourceModelField FieldName="QuantityPerUnit" DataType="String" />
                <telerik:ClientDataSourceModelField FieldName="UnitPrice" DataType="Number" />
                <telerik:ClientDataSourceModelField FieldName="UnitsInStock" DataType="Number" />
     <div class="demo-containers ">
    <div class="demo-container no-bg">
        <div class="demoWrapper">
            <div class="data">
                <telerik:RadListView ID="RadListView1" runat="server" RenderMode="Lightweight" ClientDataSourceID="RadClientDataSource1" AllowMultiFieldSorting="true"
                    AllowPaging="true" PageSize="6">
                        <div class="RadListView RadListView_Default">
                            <ul id="itemPlaceholder" runat="server">
                          <li class="productItem">
                              <img width="110" height="110" src="../../../../Img/Northwind/Products/#= ProductID #.jpg" alt="#= ProductName #" />
                                <div class="productInfo">
                                    <h4>#= ProductName #</h4>
                                    <div class="left">
                                        <span class="quantityPerUnit">#= QuantityPerUnit #</span>
                                        <span class="unitsInStock">Units in stock: #= UnitsInStock #</span>
                                    <div class="unitPrice right">$#= UnitPrice #</div>
                <div class="pager">
                    <hr />
                    <telerik:RadSlider RenderMode="Lightweight" ID="pageSlider" runat="server" MaximumValue="0" ItemType="Tick" Height="50px" Width="500px">
                    <span runat="server" class="pagerLabel" id="PagerLabel">Page 1 of 10</span>
                    <hr style="clear: both;"/>
            <div class="filterSortPanel">
                <div class="filterPanel commonPanel">
                    <span>By Price:</span>
                    <telerik:RadSlider RenderMode="Lightweight" ID="priceSlider" runat="server" Height="50px" IsSelectionRangeEnabled="true" ItemType="Item" Width="240px">
                    <hr />
                    <span>By units in Stock:</span>
                    <telerik:RadSlider RenderMode="Lightweight" ID="stockSlider" runat="server" Height="50px" IsSelectionRangeEnabled="true" ItemType="Item" Width="240px">
                    <hr />
                <div class="sortPanel commonPanel">
                    <telerik:RadListBox RenderMode="Lightweight" runat="server" ID="RadListBox1" Height="200px" Width="100%"
                        EnableDragAndDrop="true" AllowReorder="true" ButtonSettings-ShowReorder="false" ToolTip="Drag to reorder fields">
                            <asp:CheckBox runat="server" ID="sdf2" ToolTip="Click to change sort order" /><%# DataBinder.Eval(Container, "Text")%>
                            <telerik:RadListBoxItem Text="Units In Stock" Value="UnitsInStock"></telerik:RadListBoxItem>
                            <telerik:RadListBoxItem Text="Name" Value="ProductName"></telerik:RadListBoxItem>
                            <telerik:RadListBoxItem Text="Unit Price" Value="UnitPrice"></telerik:RadListBoxItem>

Support & Learning Resources

Find Assistance