Grid - Data Binding 300,000 records via LINQ

Test Results: Time to retrieve data:402ms (from Selecting to Selected LinqDataSource events)
Time to bind, aggregate(if needed) and render data: 27ms
Server time:429ms (from Init to Render)

Page size:
 300000 items in 30000 pages
Jimmy LewisLedger: Inconsistency. Please fix it.11/17/14False242.83 Kb
Jeffrey W McClainScreen Redraw. Somebody has to look at it.12/09/14False151.77 Kb
Steve LeeMain Menu: Add a File menu. File menu item is missing.12/22/14True83.25 Kb
Bert ParkinsDrag & Drop operations are not available in the scheduler module.12/23/14False8.46 Kb
Jimmy LewisEmail Attachments. Is it possible to add multiple attachments? I haven't found a way to do this.12/04/14False14.25 Kb
Ryan FischerScreen Redraw. Somebody has to look at it.11/20/14True97.82 Kb
Tom HamlettMain Menu: Duplicate Items. Somebody has to review all menu items in the system.11/07/14False207.28 Kb
Peter DolanCurrency Mask. The current currency mask in completely unusable.11/30/14False9.7 Kb
Ray ShipmanReceivables Printing module is ready for testing.11/17/14False109.59 Kb
Tom HamlettWeb Edition: Data Entry Page. There is an issue with date validation.11/14/14False48.18 Kb
This demo takes LINQ(Language Integrated Query) expressions to sorting, filtering and paing the data. According to this technique, the action processing time is much reduced, so that the grid display the data to view much more quicklier. Note: LINQ can be used in .NET 3.5 or higher version.
Kettic DataGridView provides the support of showing hierarchical data to an arbitrary number of levels and establishing the hierarchical at either run time or design time. The GridView control allows users generate hierarchical data automatically at runtime as well as create hierarchical data in C# code for ASP.NET Web Forms application.

Kettic ASP.NET AJAX grid control not only can show large data using linq, but also can bind commonly used data type to grid.
And developers can customize the data row style and data column types freely.

<%@ Page Title="" Language="C#" MasterPageFile="~/Demo.Master" AutoEventWireup="true" CodeBehind="300000Linq.aspx.cs" Inherits="Kettic.AspNet.Demo.KaxGridDemo.DataBinding.Linq300000" %>

<%@ Import Namespace="Kettic.AspNet.Demo" %>
<%@ Register Assembly="Kettic.AspNet.Controls,Version=2014.04.1129.0" Namespace="Kettic.AspNet.Controls" TagPrefix="kettic" %>
<asp:Content ID="Content1" ContentPlaceHolderID="DemoContent" runat="server">
    <div style="float: left;">
        <fieldset style="padding: 5px; height: 80px;">
            <legend style="margin-bottom: 10px">Test Results:</legend>
            Time to retrieve data:<asp:Label ID="Label1" ForeColor="Red" Font-Bold="true" runat="server"></asp:Label>ms <em>(from Selecting to Selected LinqDataSource events)</em>
            <br />
            <b>Time to bind, aggregate(if needed) and render data: </b>
            <asp:Label ID="Label2" ForeColor="Red" Font-Bold="true" runat="server"></asp:Label>ms
        <br />
            Server time:<asp:Label ID="Label3" ForeColor="Red" Font-Bold="true" runat="server"></asp:Label>ms <em>(from Init to Render)</em>
    <b class="Clear"></b>
    <br />
    <br />
    <kettic:KaxGrid AutoGenerateColumns="False" ID="GridLinq"
        DataSourceID="LinqDataSource" AllowFilteringByColumn="True" AllowPaging="True"
        AllowSorting="True" runat="server" GridLines="None" OnItemDataBound="GridLinq_OnItemDataBound">
        <PagerStyle Mode="NextPrevAndNumeric" />
        <GroupingSettings CaseSensitive="false" />
        <MainView TableLayout="Fixed">
                <kettic:GridBoundColumn UniqueName="From" HeaderText="From" DataField="From">
                    <HeaderStyle Width="160px" />
                <kettic:GridBoundColumn UniqueName="Subject" HeaderText="Subject" DataField="Subject">
                <kettic:GridDateTimeColumn UniqueName="Sent" HeaderText="Sent" DataField="Sent" DataFormatString="{0:MM/dd/yy}">
                    <HeaderStyle Width="120px" />
                <kettic:GridBoundColumn UniqueName="HasAttachment" HeaderText="Attachment?" DataField="HasAttachment">
                    <HeaderStyle Width="100px" />
                <kettic:GridBoundColumn UniqueName="Size" HeaderText="Size" DataField="Size">
                    <HeaderStyle Width="80px" />
<asp:LinqDataSource ID="LinqDataSource" runat="server" ContextTypeName="Kettic.AspNet.Demo.App_Code.LargeDataContext"
TableName="Emails" />

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Kettic.AspNet.Controls;

namespace Kettic.AspNet.Demo.KaxGridDemo.DataBinding
    public partial class Linq300000 : System.Web.UI.Page
        Stopwatch watch = new Stopwatch();
        Stopwatch retrieveWatch = new Stopwatch();
        protected void Page_Load(object sender, EventArgs e)
            LinqDataSource.Selecting += LinqDataSource_Selecting;
            LinqDataSource.Selected += LinqDataSource_Selected;

        void LinqDataSource_Selected(object sender, LinqDataSourceStatusEventArgs e)

        void LinqDataSource_Selecting(object sender, LinqDataSourceSelectEventArgs e)
            e.Arguments.TotalRowCount = 300000;

        protected override void Render(HtmlTextWriter writer)

            Label1.Text = retrieveWatch.ElapsedMilliseconds.ToString();
            Label2.Text = (watch.ElapsedMilliseconds - retrieveWatch.ElapsedMilliseconds).ToString();
            Label3.Text = watch.ElapsedMilliseconds.ToString();


        protected void GridLinq_OnItemDataBound(object sender, GridItemEventArgs e)
            if (e.Item is GridDataItem)
                GridDataItem item = (GridDataItem)e.Item;
                item["Size"].Text = FormatFileSize(item["Size"].Text);

        public static String FormatFileSize(String value)
            if (!String.IsNullOrEmpty(value))
                Double amount;
                if (Double.TryParse(value, out amount))
                    var unit = "b";
                    if (amount > 1000)
                        amount /= 1024;
                        unit = "Kb";
                    if (amount > 1000)
                        amount /= 1024;
                        unit = "Mb";
                    if (amount > 1000)
                        amount /= 1024;
                        unit = "Gb";
                    return String.Format("{0:#,0.##} {1}", amount, unit);
            return String.Empty;
Copyright © 2008-2017 Kettic Inc
Your Next ASP.NET Site Best Choice

Get started today and download ASP.NET AJAX UI Controls and SDKs for 30-day free try.

Kettic provide rich online demos to view the features of each UI control. And you can find comprehensive guide to use ASP.NET controls

For more information about Kettic UI SDK, please visit the ASP.NET AJAX Controls webpage. For immediate assistance, contact us by Email at