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

[Solved] Custom server binding with Entity Framework

1 Answer 66 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.
phuongdu
Top achievements
Rank 1
phuongdu asked on 15 May 2011, 05:00 AM
Hi everyone,
I built a asp.net mvc application and grid telerik. I used custom server binding like this demo http://demos.telerik.com/aspnet-mvc/grid/customserverbinding but I don't use Linq to SQL model. I use Entity framework and I have a problem in paging. In Entity framework, I have to order before use skip method. So I'll lost sorting result when I paging.
This paging method in demo
public static IQueryable<Order> ApplyPaging(this IQueryable<Order> data, int currentPage, int
            pageSize)
        {
            if (pageSize > 0 && currentPage > 0)
            {
                data = data.Skip((currentPage - 1) * pageSize);
            }
            data = data.Take(pageSize);
            return data;
        }

I'll get error unless orderby before skip method. Can anyone help me this problem in Entity Framwork?

Many thanks.

1 Answer, 1 is accepted

Sort by
0
phuongdu
Top achievements
Rank 1
answered on 16 May 2011, 03:13 AM
Can anyone help me? Thanks
Tags
Grid
Asked by
phuongdu
Top achievements
Rank 1
Answers by
phuongdu
Top achievements
Rank 1
Share this question
or