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

[Solved] Ajax Grid Queries Executed Twice

0 Answers 26 Views
Grid
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Christopher
Top achievements
Rank 1
Christopher asked on 23 May 2011, 03:17 PM
I'm using an MVC Grid with Client Binding. I'm not using CustomBinding, just passing in an IEnumerable LINQ query that has not executed yet.

The grid works exactly as expected. but using Entity Framework Profiler and  SQL Profiler it shows that the query is executed twice as soon as I add the Sortable or Pageable options to the grid.

The first query in the Entity Framework Profiler doesn't have a Row Count but the duration is almost as long as the second query that does have a row count.

Am I doing something wrong? Should I be passing in a List instead? I assume if I do that though I need to implement CustomBinding to take care of the paging and sorting myself.

The Entity Framework Profiler stack trace for the first query is:
Telerik.Web.Mvc.Extensions.Telerik.Web.Mvc.Extensions.EnumerableExtensions.AsGenericEnumerable
Telerik.Web.Mvc.UI.Telerik.Web.Mvc.UI.GridDataProcessor.EnsureDataSourceIsProcessed
Telerik.Web.Mvc.UI.Telerik.Web.Mvc.UI.GridDataProcessor.get_ProcessedDataSource
Telerik.Web.Mvc.Telerik.Web.Mvc.GridActionAttribute.OnActionExecuted.

The Entity Framework Profiler stack trace for the 2nd query is:
Telerik.Web.Mvc.Extensions.Telerik.Web.Mvc.Extensions.EnumerableExtensions+GenericEnumerable'1.System.Collections.IEnumerable..GetEnumerator
Tags
Grid
Asked by
Christopher
Top achievements
Rank 1
Share this question
or