The method 'Skip' is only supported for sorted input in LINQ to Entities. The method 'OrderBy' must be called before the method 'Skip'.
- you must order your result - use OrderBy or OrderByDescending function
- in my case
var stylemasters = db.StyleMasters.Include(s => s.GroupMaster).Include(s => s.StyleTypeMaster);
switch (sortBy)
{
case "Name desc":
stylemasters = stylemasters.OrderByDescending(s => s.StyleName);
break;
case "Name":
stylemasters = stylemasters.OrderBy(s => s.StyleName);
break;
case "Description desc":
stylemasters = stylemasters.OrderByDescending(s => s.StyleDescription);
break;
case "Description":
stylemasters = stylemasters.OrderBy(s => s.StyleDescription);
break;
default:
stylemasters = stylemasters.OrderBy(s => s.StyleName);
break;
}
it help me, thy
ReplyDelete