This is a migrated thread and some comments may be shown as answers.

Linq to sql RadGrid Paging Speed

5 Answers 171 Views
Grid
This is a migrated thread and some comments may be shown as answers.
John
Top achievements
Rank 1
John asked on 03 Dec 2008, 10:50 PM
I have a database with simple table with 1.2 million rows and when I put that into a grid using linq, paging is painfully slow.  In the demo http://demos.telerik.com/aspnet-ajax/Grid/Examples/GeneralFeatures/ASPNET35/DefaultCS.aspx it looks like the source code isn't all there, am i missing something?  When I put in the .cs file code that is listed in the demo I get no results when paging or sorting, something is missing.

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default"  %> 
<%@ Register TagPrefix="telerik" Namespace="Telerik.Web.UI" Assembly="Telerik.Web.UI" %> 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
 
<html xmlns="http://www.w3.org/1999/xhtml"
<head runat="server"
    <title></title
</head> 
<body> 
    <form id="form1" runat="server"
    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> 
    <div> 
    <telerik:RadAjaxPanel runat="server" ID="RadAjaxPanel1" LoadingPanelID="RadAjaxLoadingPanel1" EnableAJAX="true"
    <telerik:RadGrid ID="RadGrid1" EnableLinqExpressions="true" Skin="Vista" DataSourceID="LinqDataSource1" PageSize="100" 
    AllowFilteringByColumn="True" AllowPaging="True" AllowSorting="True"  EnableViewState="false" 
            runat="server"
<HeaderContextMenu Skin="Vista" EnableTheming="True"
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
</HeaderContextMenu> 
 
    <PagerStyle Mode="NextPrevAndNumeric" Position="TopAndBottom" /> 
 
<MasterTableView DataSourceID="LinqDataSource1" AutoGenerateColumns="False"
<RowIndicatorColumn> 
<HeaderStyle Width="20px"></HeaderStyle> 
</RowIndicatorColumn> 
 
<ExpandCollapseColumn> 
<HeaderStyle Width="20px"></HeaderStyle> 
</ExpandCollapseColumn> 
    <Columns> 
        <telerik:GridBoundColumn DataField="Column1" HeaderText="Column1"  
            SortExpression="Column1" UniqueName="Column1"
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="Column2" HeaderText="Column2"  
            SortExpression="Column2" UniqueName="Column2"
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="Column3" HeaderText="Column3"  
            SortExpression="Column3" UniqueName="Column3"
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="Column4" HeaderText="Column4"  
            SortExpression="Column4" UniqueName="Column4"
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="Column5" HeaderText="Column5"  
            SortExpression="Column5" UniqueName="Column5"
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="Column7" DataType="System.Char"  
            HeaderText="Column7" SortExpression="Column7" UniqueName="Column7"
        </telerik:GridBoundColumn> 
        <telerik:GridBoundColumn DataField="Column9" HeaderText="Column9"  
            SortExpression="Column9" UniqueName="Column9"
        </telerik:GridBoundColumn> 
    </Columns> 
</MasterTableView> 
 
<FilterMenu Skin="Hay" EnableTheming="True"
<CollapseAnimation Type="OutQuint" Duration="200"></CollapseAnimation> 
</FilterMenu> 
</telerik:RadGrid> 
        <asp:LinqDataSource ID="LinqDataSource1" runat="server"  
            ContextTypeName="Kelly.RAPData" TableName="RAPs" AutoPage="true"
        </asp:LinqDataSource> 
    <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Height="75px" Width="75px" Transparency="5"
        <img style="margin-top:50px;" alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading4.gif") %>' /> 
    </telerik:RadAjaxLoadingPanel>          
    </telerik:RadAjaxPanel> 
    </div> 
    </form> 
</body> 
</html> 
 



5 Answers, 1 is accepted

Sort by
0
John
Top achievements
Rank 1
answered on 03 Dec 2008, 11:43 PM
Whoops, when i imported in the 1.2 million rows I neglected to create an Identity column. adding that helps.  However I'm still perplexed as to why this demo doesn't show all the code?
0
Vlad
Telerik team
answered on 04 Dec 2008, 08:11 AM
Hello John,

Indeed our QSF runs on .NET 2.0 and that is why we hosted our LinqDataSource demo in different application. You can find the code in the description of the demo.

We will do our best to switch our QSF to .NET 3.5 for the next release and in the meantime don't hesitate to contact us if you have other questions.

Best wishes,
Vlad
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
John
Top achievements
Rank 1
answered on 05 Dec 2008, 12:55 AM
Would you mind pasting me a link to the code?  I don't see any code in the description.  And when I try and do the caching as showing in the little bit of code on the page, it doesn't work right.  Paging doesn't change, and the filters only result is on what the page is.  What am I missing?

Here is my cs file

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Web; 
using System.Web.UI; 
using System.Web.UI.WebControls; 
using Telerik.Web.UI; 
using Kelly; 
 
public partial class _Default : System.Web.UI.Page  
    protected void Page_Load(object sender, EventArgs e) 
    { 
 
    } 
    protected void RadGrid1_PreRender(object sender, EventArgs e) 
    { 
        foreach (GridDataItem dataItem in RadGrid1.MasterTableView.Items) 
        { 
            dataItem["Column9"].Text = dataItem["Column9"].Text.Replace(";", "<br />"); 
        } 
    } 
    protected void Page_Init(object sender, EventArgs e) 
    { 
        LinqDataSource1.Selecting += new EventHandler<LinqDataSourceSelectEventArgs>(LinqDataSource1_Selecting); 
        LinqDataSource1.Selected += new EventHandler<LinqDataSourceStatusEventArgs>(LinqDataSource1_Selected); 
    } 
    void LinqDataSource1_Selecting(object sender, LinqDataSourceSelectEventArgs e) 
    { 
        e.Arguments.TotalRowCount = 1290575
 
            if (Cache["MyData"] != null) 
            { 
                e.Result = Cache["MyData"]; 
            } 
    } 
    void LinqDataSource1_Selected(object sender, LinqDataSourceStatusEventArgs e) 
    { 
        if (Cache["MyData"] == null) 
        { 
            Cache["MyData"] = e.Result; 
        } 
    } 
    protected override void Render(HtmlTextWriter writer) 
    { 
        base.Render(writer); 
    } 
 
 
 
 
 
 

0
Iana Tsolova
Telerik team
answered on 09 Dec 2008, 01:06 PM
Hello John,

I prepared a sample project for you based on the preceding demo. Please check it out and let me know if any questions arise.

I hope this helps.

Best wishes,
Iana
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
mzukisi
Top achievements
Rank 1
answered on 20 Jul 2010, 11:36 AM
Add this to your grid..
....
      <ClientSettings>
           <Selecting AllowRowSelect="true" />
           <DataBinding EnableCaching="true" />
       </ClientSettings>
   </telerik:RadGrid>
Tags
Grid
Asked by
John
Top achievements
Rank 1
Answers by
John
Top achievements
Rank 1
Vlad
Telerik team
Iana Tsolova
Telerik team
mzukisi
Top achievements
Rank 1
Share this question
or