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

300 000 Rows with EntityDataSource

Drag a column header and drop it here to group by that column
ProductIDProduct nameUnit priceQuantity per unitUnits in stockDiscontinued
Page size:
 335104 items in 33511 pages
1Chai$18.0010 boxes x 20 bags39
2Chang$19.0024 - 12 oz bottles17
3Aniseed Syrup$10.0012 - 550 ml bottles13
4Chef Anton's Cajun Seasoning$22.0048 - 6 oz jars53
5Chef Anton's Gumbo Mix$21.3536 boxes0
6Grandma's Boysenberry Spread$25.0012 - 8 oz jars120
7Uncle Bob's Organic Dried Pears$30.0012 - 1 lb pkgs.15
8Northwoods Cranberry Sauce$40.0012 - 12 oz jars6
9Mishi Kobe Niku$97.0018 - 500 g pkgs.29
10Ikura$31.0012 - 200 ml jars31
  • NoFilter
  • Contains
  • DoesNotContain
  • StartsWith
  • EndsWith
  • EqualTo
  • NotEqualTo
  • GreaterThan
  • LessThan
  • GreaterThanOrEqualTo
  • LessThanOrEqualTo
  • Between
  • NotBetween
  • IsEmpty
  • NotIsEmpty
  • IsNull
  • NotIsNull
  • Custom
  • Demo Configurator
Settings
Measurements 44 ms (from Selecting to Selected EntityDataSource events)
54 ms
98 ms (from Init to Render)
Perform sorting/paging/filtering/grouping operation to see total time
This demo illustrates the optimized performance techniques incorporated in the ASP.NET 3.5 build of RadGrid. The control takes advantage of the Entity Framework and performs sorting/filtering/paging operations on a database server. This technique significantly reduces the time necessary to process these actions "behind the scenes" and allows you to handle millions of records within a few milliseconds.

For better visual indication we output the period of time between the Init and Render stages of the control lifecycle just below the grid table.

You may also see how to utilize OpenAccess ORM, Telerik's free enterprise-grade ORM, to generate the data access layer for your app in just a few mouse clicks. You can download the Software Development Kit (SDK) for OpenAccess here. By doing the heavy lifting, OpenAccess can save you between 20% and 85% of development and testing time.

  • defaultcs.aspx
  • defaultcs.aspx.cs
  • styles.css
<%@ Page Language="C#" Inherits="Telerik.GridExamplesCSharp.DataEditing.ProgramaticLinqUpdates.DefaultCS"CodeFile="defaultcs.aspx.cs"  %>

<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %>
<%@ Register TagPrefix="qsf" Namespace="Telerik.QuickStart" %>
<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml'>
<head runat="server">
    <title>Telerik ASP.NET Example</title>
    <link href="styles.css" rel="stylesheet" />
    <telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
        <script type="text/javascript">
            function RequestStart(sender, eventArgs) {
                //Log the start time
                startTime = new Date();
            }
            function ResponseEnd(sender, eventArgs) {
                //Log the end time
                var endTime = new Date();
                //Display the total time
                $get("<%= lblTotal.ClientID %>").innerHTML = endTime - startTime + " ms";
            }
        </script>
    </telerik:RadCodeBlock>
</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" RequestQueueSize="5">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="CheckBox1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                    <telerik:AjaxUpdatedControl ControlID="Label1" />
                    <telerik:AjaxUpdatedControl ControlID="Label2" />
                    <telerik:AjaxUpdatedControl ControlID="Label3" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="CheckBox2">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                    <telerik:AjaxUpdatedControl ControlID="Label1" />
                    <telerik:AjaxUpdatedControl ControlID="Label2" />
                    <telerik:AjaxUpdatedControl ControlID="Label3" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                    <telerik:AjaxUpdatedControl ControlID="Label1" />
                    <telerik:AjaxUpdatedControl ControlID="Label2" />
                    <telerik:AjaxUpdatedControl ControlID="Label3" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
        <ClientEvents OnRequestStart="RequestStart" OnResponseEnd="ResponseEnd" />
    </telerik:RadAjaxManager>
    <telerik:RadAjaxLoadingPanel runat="server" ID="RadAjaxLoadingPanel1" />
    <div class="demo-container no-bg">
        <telerik:RadGrid RenderMode="Lightweight" AutoGenerateColumns="False" ID="RadGrid1" DataSourceID="EntityDataSource1"
            AllowFilteringByColumn="True" AllowPaging="True" AllowSorting="True" runat="server"
            ShowGroupPanel="true">
            <PagerStyle Mode="NextPrevAndNumeric" />
            <GroupingSettings CaseSensitive="false" />
            <MasterTableView TableLayout="Fixed">
                <Columns>
                    <telerik:GridNumericColumn Aggregate="Count" HeaderText="ProductID" DataField="ProductID"
                        UniqueName="ProductID" SortExpression="ProductID" HeaderStyle-Width="60px" FilterControlWidth="40px"
                        AutoPostBackOnFilter="true" CurrentFilterFunction="equalto" ShowFilterIcon="false" />
                    <telerik:GridBoundColumn HeaderText="Product name" DataField="ProductName" UniqueName="ProductName"
                        SortExpression="ProductName" HeaderStyle-Width="180px" FilterControlWidth="140px"
                        AutoPostBackOnFilter="true" CurrentFilterFunction="Contains" ShowFilterIcon="false" />
                    <telerik:GridNumericColumn Aggregate="Sum" DataFormatString="{0:C}" FooterAggregateFormatString="<b>Total Price:</b> {0:C}"
                        HeaderText="Unit price" DataField="UnitPrice" UniqueName="UnitPrice" SortExpression="UnitPrice"
                        FilterControlWidth="80px" HeaderStyle-Width="115px" />
                    <telerik:GridBoundColumn HeaderText="Quantity per unit" DataField="QuantityPerUnit"
                        UniqueName="QuantityPerUnit" SortExpression="QuantityPerUnit" HeaderStyle-Width="110px"
                        FilterControlWidth="90px" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains"
                        ShowFilterIcon="false" />
                    <telerik:GridNumericColumn Aggregate="Sum" FooterAggregateFormatString="<b>Total Units: </b>{0}"
                        HeaderText="Units in stock" DataField="UnitsInStock" UniqueName="UnitsInStock"
                        SortExpression="UnitsInStock" FilterControlWidth="80px" HeaderStyle-Width="120px" />
                    <telerik:GridCheckBoxColumn DataField="Discontinued" UniqueName="Discontinued" HeaderText="Discontinued"
                        HeaderStyle-Width="70px" />
                </Columns>
            </MasterTableView>
            <ClientSettings AllowDragToGroup="true">
            </ClientSettings>
        </telerik:RadGrid>
    </div>
    <asp:EntityDataSource runat="server" ID="EntityDataSource1" ConnectionString="name=TelerikReadOnlyEntities"
        DefaultContainerName="TelerikReadOnlyEntities" EnableFlattening="False" EntitySetName="LargeProducts">
    </asp:EntityDataSource>
    <qsf:ConfiguratorPanel ID="ConfiguratorPanel1" runat="server">
        <Views>
            <qsf:View>
                <qsf:ConfiguratorColumn runat="server" Size="Wide" Title="Settings">
                    <ul class="fb-group">
                        <li>
                            <asp:CheckBox ID="CheckBox2" Text="Let RadGrid do the sorting instead of the SQL Server"
                                AutoPostBack="true" runat="server" />
                        </li>
                        <li>
                            <asp:CheckBox ID="CheckBox1" Text="Show aggregates" AutoPostBack="true" runat="server" />
                        </li>
                    </ul>
                </qsf:ConfiguratorColumn>
                <qsf:ConfiguratorColumn runat="server" Size="Wide" Title="Measurements">
                    <label>Time to retrieve data:</label>
                    <asp:Label ID="Label1" ForeColor="#2eb246" Font-Bold="true" runat="server"></asp:Label>
                    ms
                    <em style="font-size: 12px; color: #2eb246;">(from Selecting to Selected EntityDataSource events)</em>
                    <br />
                    <label>Time to bind, aggregate and render data:</label>
                    <asp:Label ID="Label2" ForeColor="#2eb246" Font-Bold="true" runat="server"></asp:Label>
                    ms
                    <br />
                    <label>Server time:</label>
                    <asp:Label ID="Label3" ForeColor="#2eb246" Font-Bold="true" runat="server"></asp:Label>
                    ms <em style="font-size: 12px; color: #2eb246;">(from Init to Render)</em>
                    <br />
                    <label class="total">Total time:</label>
                    <asp:Label ID="lblTotal" ForeColor="#2eb246" Font-Bold="true" runat="server">
                        <i>Perform sorting/paging/filtering/grouping operation to see total time</i>
                    </asp:Label>
                </qsf:ConfiguratorColumn>
            </qsf:View>
        </Views>
    </qsf:ConfiguratorPanel>
    </form>
</body>
</html>

Support & Learning Resources

Find Assistance