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

Grid with DomainDataSource

2 Answers 82 Views
Grid
This is a migrated thread and some comments may be shown as answers.
JiriSchmitt
Top achievements
Rank 1
JiriSchmitt asked on 14 Jan 2012, 08:54 PM
Hello,

I'm trying use domain data source with RadGrid in ASP.NET 4.0 project (by this demo http://demos.telerik.com/aspnet-ajax/grid/examples/programming/domaindatasource/defaultcs.aspx). I'm using LinqToEntitiesDomainService (EntityFramework).
<telerik:RadGrid ID="groups" runat="server" AllowPaging="true" DataSourceID="dsGroups">
    <MasterTableView CommandItemDisplay="Top" AllowAutomaticInserts="true" AllowAutomaticDeletes="true"
        AllowAutomaticUpdates="true" AutoGenerateColumns="false" DataKeyNames="GroupId">
        <Columns>
            <telerik:GridEditCommandColumn ButtonType="ImageButton" />
            <telerik:GridBoundColumn DataField="Name" HeaderText="Name" />
            <telerik:GridBoundColumn DataField="Description" HeaderText="Description" />
            <telerik:GridButtonColumn ButtonType="ImageButton" CommandName="Delete" />
        </Columns>
    </MasterTableView>
</telerik:RadGrid>
<asp:DomainDataSource ID="dsGroups" runat="server" DomainServiceTypeName="DataSources.GroupsDomainService"
    EnableDelete="True" EnableInsert="True" EnableUpdate="True" QueryName="GetGroups">
</asp:DomainDataSource>

I'm getting following error:

Server Error in '/' Application.

The method 'Skip' is only supported for sorted input in LINQ to Entities. The method 'OrderBy' must be called before the method 'Skip'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.NotSupportedException: The method 'Skip' is only supported for sorted input in LINQ to Entities. The method 'OrderBy' must be called before the method 'Skip'.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[NotSupportedException: The method 'Skip' is only supported for sorted input in LINQ to Entities. The method 'OrderBy' must be called before the method 'Skip'.]
   System.Data.Objects.ELinq.PassthroughOrderByLifter.Skip(DbExpression k) +94
   System.Data.Objects.ELinq.ExpressionConverter.Skip(DbExpressionBinding input, DbExpression skipCount) +31
   System.Data.Objects.ELinq.SkipTranslator.TranslatePagingOperator(ExpressionConverter parent, DbExpression operand, DbExpression count) +63
   System.Data.Objects.ELinq.PagingTranslator.TranslateUnary(ExpressionConverter parent, DbExpression operand, MethodCallExpression call) +62
   System.Data.Objects.ELinq.UnarySequenceMethodTranslator.Translate(ExpressionConverter parent, MethodCallExpression call) +81
   System.Data.Objects.ELinq.SequenceMethodTranslator.Translate(ExpressionConverter parent, MethodCallExpression call, SequenceMethod sequenceMethod) +14
   System.Data.Objects.ELinq.MethodCallTranslator.TypedTranslate(ExpressionConverter parent, MethodCallExpression linq) +102
   System.Data.Objects.ELinq.TypedTranslator`1.Translate(ExpressionConverter parent, Expression linq) +54
   System.Data.Objects.ELinq.ExpressionConverter.TranslateExpression(Expression linq) +110
   System.Data.Objects.ELinq.UnarySequenceMethodTranslator.Translate(ExpressionConverter parent, MethodCallExpression call) +58
   System.Data.Objects.ELinq.SequenceMethodTranslator.Translate(ExpressionConverter parent, MethodCallExpression call, SequenceMethod sequenceMethod) +14
   System.Data.Objects.ELinq.MethodCallTranslator.TypedTranslate(ExpressionConverter parent, MethodCallExpression linq) +102
   System.Data.Objects.ELinq.TypedTranslator`1.Translate(ExpressionConverter parent, Expression linq) +54
   System.Data.Objects.ELinq.ExpressionConverter.TranslateExpression(Expression linq) +110
   System.Data.Objects.ELinq.ExpressionConverter.Convert() +16
   System.Data.Objects.ELinq.ELinqQueryState.GetExecutionPlan(Nullable`1 forMergeOption) +110
   System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption) +149
   System.Data.Objects.ObjectQuery`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator() +44
   System.Data.Objects.ObjectQuery`1.GetEnumeratorInternal() +36
   System.Data.Objects.ObjectQuery.System.Collections.IEnumerable.GetEnumerator() +10
   System.ServiceModel.DomainServices.Server.DomainService.Enumerate(IEnumerable enumerable, Int32 estimatedResultCount) +299
   System.ServiceModel.DomainServices.Server.DomainService.Query(QueryDescription queryDescription, IEnumerable`1& validationErrors, Int32& totalCount) +1289
   Microsoft.Web.UI.WebControls.DomainDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +435
   System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +21
   System.Web.UI.WebControls.DataBoundControl.PerformSelect() +143
   Telerik.Web.UI.GridTableView.PerformSelect() +16
   System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +74
   Telerik.Web.UI.GridTableView.DataBind() +259
   Telerik.Web.UI.RadGrid.DataBind() +87
   System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +66
   System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +75
   System.Web.UI.Control.EnsureChildControls() +102
   Telerik.Web.UI.GridBaseDataList.get_Controls() +15
   Telerik.Web.UI.RadFormDecorator.FindAndDecorateControls(Control parent) +41
   Telerik.Web.UI.RadFormDecorator.FindAndDecorateControls(Control parent) +623
   Telerik.Web.UI.RadFormDecorator.FindAndDecorateControls(Control parent) +623
   Telerik.Web.UI.RadFormDecorator.FindAndDecorateControls(Control parent) +623
   Telerik.Web.UI.RadFormDecorator.FindAndDecorateControls(Control parent) +623
   Telerik.Web.UI.RadFormDecorator.DecorateAspNetControls() +39
   Telerik.Web.UI.RadFormDecorator.ControlPreRender() +624
   Telerik.Web.UI.RadWebControl.OnPreRender(EventArgs e) +22
   System.Web.UI.Control.PreRenderRecursiveInternal() +103
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Control.PreRenderRecursiveInternal() +175
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2496


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.237


Could you help me please?

Thank you



2 Answers, 1 is accepted

Sort by
0
Accepted
Tsvetina
Telerik team
answered on 17 Jan 2012, 03:52 PM
Hi Jiri,

Can you please confirm that your GroupsDomainService follows the instruction from the exception message?
Also, you can try setting the OverrideDataSourceControlSorting property of the MasterTableView to true.

If the issue persists, please open a formal support ticket and send us a runnable sample replicating the problem at hand, so that we can review and debug it locally.

All the best,
Tsvetina
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
JiriSchmitt
Top achievements
Rank 1
answered on 17 Jan 2012, 06:44 PM
Thank you very much,

I added to end of the query in domain service function for sorting by SortParameterName.

Regards
Jiri
Tags
Grid
Asked by
JiriSchmitt
Top achievements
Rank 1
Answers by
Tsvetina
Telerik team
JiriSchmitt
Top achievements
Rank 1
Share this question
or