Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Mar 01, 2012 09:55 PM by aspnetiano
Feb 29, 2012 06:46 PM|LINK
I've done the PaginatedList as the following but I'm trying to display the result of query (it's an sqlserver view that I've drag and drop to do it as a table Model) and there's something that is changing the order I've specified in the query. The AddRange
or the Take... because before I debugged and I could see that the order is good until the source object.
public PaginatedList(IQueryable<T> source, int pageIndex, int pageSize)
PageIndex = pageIndex;
PageSize = pageSize;
TotalCount = source.Count();
TotalPages = (int)Math.Ceiling(TotalCount / (double)PageSize);
this.AddRange(source.Skip(PageIndex * PageSize).Take(PageSize));
Feb 29, 2012 09:04 PM|LINK
and there's something that is changing the order I've specified in the query
No one is changing. However, you can pass an IOrderedQueryable - to be sure about the order.
Mar 01, 2012 09:55 PM|LINK
Ok, thank you!
I've used the db.Model.OrderBy(...); instead of db.Model; and that worked.
Thanks again for pointing me on the solution.