Hi there!
Im hoping that someone has used the very excellent PagedList from Troy Goode? Im actually using it in a Winforms app, and while it does work, I have lost the ability to sort it.
Returning a PagedList, controlling the Page and Size, and binding to a DataGridView is no issue, but my biggest concern is Sorting. Now I have also come across the SortedPageList by Muhammad Mosa, but I really am confused with one of the parameter requirements. I am using a private method to return a SortedPageList, but my code below does not seem to work:
private SortedPagedList<Location, Location> GetInactiveLocationData(int Index, int Size) {
sysDataContext ctx = new sysDataContext();
try {
var query = ctx.Location.Where(x => x.Active == false).AsQueryable();
return query.ToPagedList(Index, Size, i => i, false);
//return new SortedPagedList<Location, Location>(query, Index, Size, i => i , true);
}
catch (Exception) {
throw;
}
}
This throws an error "Cannot order by type: Location
". Obvously, I would like to handle the case where the user clciks a column header to sort on that column.
I know that the solution involves Lambda Expressions above a level of knowledge I have (embarrassing as it is to admit) and I am completely clueless on this front! I would really value your advice on the abovementioned!
Thank u!