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

  • Question

  • User-389597101 posted

    Hi

    I have created a dynamic data website. When I run the program I have seen the list of tables from the database in the grid. But when I click on any table I am getting the error which I have mentioned in the title.

    Am I missing anything?

    Monday, February 24, 2014 2:34 AM

Answers

  • User-330204900 posted

    hi there what data base model are you using Linq to SQL, Entity Framework or Domain Servie?

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, February 24, 2014 4:15 AM

All replies

  • User-330204900 posted

    hi there what data base model are you using Linq to SQL, Entity Framework or Domain Servie?

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, February 24, 2014 4:15 AM
  • User-389597101 posted

    Entity Framework

    Monday, February 24, 2014 4:23 AM
  • User-330204900 posted

    The only issue I am aware of is this http://forums.asp.net/p/1528965/3811692.aspx#3811692 that could cause you issue note the Pranav who gave the answer is a member of the ASP.Net team :)

    Monday, February 24, 2014 4:59 AM
  • User-389597101 posted

    Hi

    I have checked the thread and we need to add following code in list.aspx in DynamicData\PageTemplates  folder

     

    string s = e.SelectArguments.SortExpression;
                if (s.StartsWith("it."))
                    e.SelectArguments.SortExpression = s.Substring(3);


    But where do I need to add this code. I have added this code in all the methods but I am getting compile time error.

    Monday, February 24, 2014 5:26 AM
  • User-330204900 posted

    You add it in the Selecting event liek this

    /// <summary>
    /// Fixes the sort by column issue with EF
    /// see http://forums.asp.net/p/1528965/3811692.aspx#3811692
    /// </summary>
    protected void GridDataSource_Selecting(object sender, EntityDataSourceSelectingEventArgs e)
    {
        string s = e.SelectArguments.SortExpression;
        if (s.StartsWith("it."))
            e.SelectArguments.SortExpression = s.Substring(3);
    }

    remember to hook the EntityDataSources Selecting even up to this :)

    Monday, February 24, 2014 6:42 AM
  • User-389597101 posted

    Hi

    In List.aspx I have LinqDataSource

    Monday, February 24, 2014 7:03 AM
  • User753101303 posted

    Hi,

    As told by the error message do you work on sorted data ? The point is that to skip the "first" n rows you need to know in which order they are. Double check that you are sorting if you are using a skip clause...

    Monday, February 24, 2014 7:12 AM
  • User-389597101 posted

    Hi

    I have created the sample of dynamic data as I am new to this concept. I am not using skip anywhere in the solution. I have searched the whole solution.

    Monday, February 24, 2014 7:19 AM
  • User-389597101 posted

    Hi

    I got the solution I chose wrong project type. Instead of ASP.NET dynamic data LINQ to SQL Web application I have to choose ASP.NET dynamic data entities Web application.

     

    Thanks for the help

    Monday, February 24, 2014 7:32 AM
  • User-330204900 posted

    I see you added an Entity Data model to a Linq to SQl Project :) no problem we all do things like that hope everything goes well now your working.

    Monday, February 24, 2014 7:46 AM
  • User-330204900 posted

    Hi Karang, SKIP is used by the pager i.e. Sikp10 take 10 gets the next 10 entries when the pager is set to 10 items.

    Monday, February 24, 2014 7:48 AM