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

RadGrid and LinqToSQL

5 Answers 52 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Rick
Top achievements
Rank 1
Rick asked on 08 May 2012, 07:58 PM
  • I am using MS Visual Studio 2010 in a 3.5 environment.
  • I am using Microsoft Vista (32 bit)
  • The database is currently located on an SQL 2005 server.
  • I am using RadGrid & tools, version 2012.1.411.35
  • I am using both Chrome (18.0.1025.168) and Internet Explorer (8.0.7600.16385)
  • I am programming in VB.net

I'll preface this with the fact that I don't really know anything about LinqToSql.  I am trying to follow instructions online, but most always assume the reader knows more than I do.

I have an SQL database of 215,000 records that I loaded in a RadGrid with an ASP SqlDataSource.  This was slow to load, filter, sort, and go to the next or previous page.

I came across the article Grid / 300 000 Rows with LINQ and tried to implement this and eventually I did.  The data loads and I can do everything I did in the original setup.  It is still slow except for filtering which is pretty quick.  Nothing works fast like the demo on the page I linked above.

Also, the code sets the TotalRowCount to 300000, so even if it's filtered to 10 items, there are still loads of pages to page through which is odd.

I also attempted to apply the solutions located here Grid / Custom Paging, but again, it assumes the reader knows more than I do.  It also uses demo files and whatnot, so I've been unable to get it working for me.


Basically, I want to speed this up.  I'd like to get the LinqToSQL working properly.



The HTML for my page is:
<telerik:RadScriptManager ID="RadScriptManager1" runat="server"></telerik:RadScriptManager>
 
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="RadGrid1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
 
<telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" Skin="Default"></telerik:RadAjaxLoadingPanel>
<br />
 
<telerik:RadGrid ID="RadGrid1"
    AutoGenerateColumns="False" runat="server" DataSourceID="LinqDataSource1" AllowFilteringByColumn="True"
    AllowPaging="True" AllowSorting="True" ShowGroupPanel="True"
    CellSpacing="0" GridLines="None">
    <PagerStyle Mode="NextPrevAndNumeric" />
        <GroupingSettings CaseSensitive="false" />
        <MasterTableView TableLayout="Fixed">
            <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
            <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column"></RowIndicatorColumn>
            <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column"></ExpandCollapseColumn>
 
            <Columns>
                <telerik:GridBoundColumn DataField="FilePath"
                    FilterControlAltText="Filter FilePath column" HeaderText="FilePath"
                    ReadOnly="True" SortExpression="FilePath" UniqueName="FilePath">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="ProjectID"
                    FilterControlAltText="Filter ProjectID column" HeaderText="ProjectID"
                    ReadOnly="True" SortExpression="ProjectID" UniqueName="ProjectID">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Category"
                    FilterControlAltText="Filter Category column" HeaderText="Category"
                    ReadOnly="True" SortExpression="Category" UniqueName="Category">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="ProjectName"
                    FilterControlAltText="Filter ProjectName column" HeaderText="ProjectName"
                    ReadOnly="True" SortExpression="ProjectName" UniqueName="ProjectName">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="ProjCoreTitle"
                    FilterControlAltText="Filter ProjCoreTitle column" HeaderText="ProjCoreTitle"
                    ReadOnly="True" SortExpression="ProjCoreTitle" UniqueName="ProjCoreTitle">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="DrawingNumber"
                    FilterControlAltText="Filter DrawingNumber column" HeaderText="DrawingNumber"
                    ReadOnly="True" SortExpression="DrawingNumber" UniqueName="DrawingNumber">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="DrawingTitle"
                    FilterControlAltText="Filter DrawingTitle column" HeaderText="DrawingTitle"
                    ReadOnly="True" SortExpression="DrawingTitle" UniqueName="DrawingTitle">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="Description"
                    FilterControlAltText="Filter Description column" HeaderText="Description"
                    ReadOnly="True" SortExpression="Description" UniqueName="Description">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="DrawingDate" DataType="System.DateTime"
                    FilterControlAltText="Filter DrawingDate column" HeaderText="DrawingDate"
                    ReadOnly="True" SortExpression="DrawingDate" UniqueName="DrawingDate">
                </telerik:GridBoundColumn>
                <telerik:GridBoundColumn DataField="RecordCreated" DataType="System.DateTime"
                    FilterControlAltText="Filter RecordCreated column" HeaderText="RecordCreated"
                    ReadOnly="True" SortExpression="RecordCreated" UniqueName="RecordCreated">
                </telerik:GridBoundColumn>
            </Columns>
 
        <EditFormSettings>
            <EditColumn FilterControlAltText="Filter EditCommandColumn column"></EditColumn>
        </EditFormSettings>
    </MasterTableView>
    <ClientSettings AllowDragToGroup="true"></ClientSettings>
    <FilterMenu EnableImageSprites="False"></FilterMenu>
</telerik:RadGrid>
 
<asp:LinqDataSource ID="LinqDataSource1"
    AutoPage="False" runat="server" ContextTypeName="ScanBrowser.ScanBrowserContext.ScanBrowserContext"
    TableName="BrowserGridTBL" 
    Select="new (FilePath, ProjectID, Category, ProjectName, ProjCoreTitle, DrawingNumber, DrawingTitle, Description, DrawingDate, RecordCreated)">
</asp:LinqDataSource>


And the VB code behind that:
Imports Telerik.Web.UI
Imports System.Linq
Imports System.Diagnostics
Public Class WebForm2
    Inherits System.Web.UI.Page
 
    Protected Sub LinqDataSource1_Selected(sender As Object, e As System.Web.UI.WebControls.LinqDataSourceStatusEventArgs) Handles LinqDataSource1.Selected
 
        If Not Cache("MyData") Is Nothing AndAlso Not e.Result Is Nothing Then
            Cache("MyData") = e.Result
        End If
 
    End Sub
 
    Protected Sub LinqDataSource1_Selecting(sender As Object, e As System.Web.UI.WebControls.LinqDataSourceSelectEventArgs) Handles LinqDataSource1.Selecting
 
        e.Arguments.TotalRowCount = 300000
 
        If Not Cache("MyData") Is Nothing Then
            e.Result = Cache("MyData")
        End If
 
    End Sub
 
    Protected Sub RadAjaxManager1_AjaxSettingCreating(sender As Object, e As Telerik.Web.UI.AjaxSettingCreatingEventArgs) Handles RadAjaxManager1.AjaxSettingCreating
 
        If Not e.Updated Is RadGrid1 Then
            e.UpdatePanel.RenderMode = UpdatePanelRenderMode.Inline
        End If
 
    End Sub
     
End Class

Thank you for your assistance,

Rick


PS - Please have patience.  You may need to step me through some of the stuff that may be simple to you.  :)

5 Answers, 1 is accepted

Sort by
0
Rick
Top achievements
Rank 1
answered on 09 May 2012, 08:02 PM
Hello, I'm still having trouble with this.  I'm currently viewing the third video on RadGrid Optimization-- the first two didn't help.

Still looking for help.  I'm wondering if there's a demo that handles a couple hundred thousand records efficiently and quickly.  Preferable one I can download and then convert to my data source...
0
Rick
Top achievements
Rank 1
answered on 11 May 2012, 02:39 PM
Still holding out hope I'll get some assistance.

0
Tsvetoslav
Telerik team
answered on 14 May 2012, 04:23 PM
Hello Rick,

Your code seems all right. Could you specify what operations perform slowly and how much time it takes for those to complete.


Greetings,
Tsvetoslav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Rick
Top achievements
Rank 1
answered on 14 May 2012, 04:41 PM
Thanks for replying:

Sorting and paging are very slow, as is the initial load.  The times are about 6-8 seconds where as filtering will take roughly 1 second.

0
Tsvetoslav
Telerik team
answered on 15 May 2012, 12:30 PM
Hi Rick,

Please, open up a formal support ticket and attach a back-up copy of your data-base. I will test your grid set-up on my side and get back to you with further information.

All the best,
Tsvetoslav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Grid
Asked by
Rick
Top achievements
Rank 1
Answers by
Rick
Top achievements
Rank 1
Tsvetoslav
Telerik team
Share this question
or