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

Automatic server-side paging & grouping with EntityDataSource

1 Answer 167 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Roger
Top achievements
Rank 1
Veteran
Roger asked on 14 Jun 2014, 11:49 AM
Hi

I am retrieving data from database table (MS SQL Server), which can have thousands of rows. DataSource for RadGrid is an EntityDataSource control.

For performance & usability reasons I have activated paging. This works really good as long as grouping is not involved! SQL on server-side only returns rows for current page when grouping is not enabled, but when it is always all rows get returned. It was verified by SQL Profiler.

I have checked all properties in EntityDataSource (and of EntityDataSourceView control - in OnQueryCreated event) and they are all correct for paging and sorting (see http://msdn.microsoft.com/en-us/library/vstudio/cc488534%28v=vs.100%29.aspx).

And also RadGrid.EnableLinqExpressions and MasterTableView.EnableLinqGrouping are set to true.

Here relevant markup:

<telerik:RadGrid ID="VialsGrid" runat="server" CellSpacing="0"
    AllowPaging="true" PageSize="50" AllowFilteringByColumn="true" AutoPostBackOnFilter="true" AutoGenerateColumns="false" AllowSorting="true"
    GridLines="None" Width="1000" ItemStyle-VerticalAlign="Top" AlternatingItemStyle-VerticalAlign="Top"
    DataSourceID="VialsGridDataSource" EnableLinqExpressions="true" OnUpdateCommand="VialsGrid_UpdateCommand" OnItemCreated="VialsGrid_ItemCreated">
    <MasterTableView DataKeyNames="VialLocationID" Name="MasterTableView" CommandItemDisplay="Top" EnableLinqGrouping="true">
        <Columns>
            ...
        </Columns>
        <CommandItemSettings ShowAddNewRecordButton="true" ShowRefreshButton="true"></CommandItemSettings>
        <GroupByExpressions>
            <telerik:GridGroupByExpression>
                <SelectFields>
                    <telerik:GridGroupByField FieldName="VialLocationGroupName" FieldAlias="VialLocationGroupName" HeaderText="Group" />
                </SelectFields>
                <GroupByFields>
                    <telerik:GridGroupByField FieldName="VialLocationGroupName" />
                </GroupByFields>
            </telerik:GridGroupByExpression>
        </GroupByExpressions>
    </MasterTableView>
    <ClientSettings>
        <ClientEvents OnCommand="function(){}" OnMasterTableViewCreated="MasterTableViewCreated" />
    </ClientSettings>
</telerik:RadGrid>
</div>
 
<asp:EntityDataSource ID="VialsGridDataSource" runat="server"
    ConnectionString="name=EmbryoDBEntities"
    DefaultContainerName="EmbryoDBEntities" EnableFlattening="false"
    EnableInsert="false" EnableUpdate="true" EnableDelete="false"
    EntitySetName="VialLocationViews" OrderBy="it.VialLocationGroupName, it.VialLocation asc"
    AutoPage="true" AutoSort="true"
    OnQueryCreated="VialsGridDataSource_QueryCreated">
</asp:EntityDataSource>

Any ideas?

Thanks,
Roger

1 Answer, 1 is accepted

Sort by
0
Daniel
Telerik team
answered on 16 Jun 2014, 02:08 PM
Hello Roger,

It is not something in your code. When this functionality is enabled, the control will request all items from the datasource due to the fact that the grouping is performed in-memory. This is the way the RadGrid works and it does not matter what datasource control is used.

Regards,
Daniel
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Grid
Asked by
Roger
Top achievements
Rank 1
Veteran
Answers by
Daniel
Telerik team
Share this question
or