如何为网格视图执行排序操作。我已经完成了这个(下面的代码),但它抛出了以下错误。
错误:
the type arguments for method 'System.Linq.Enumerable.OrderBy<TSource,TKey>(System.Collections.Generic.IEnumerable<TSource>,
System.Func<TSource,TKey>, System.Collections.Generic.IComparer<TKey>)'
cannot be inferred from the usage.
代码:
gridview1.DataSource = (from bk in bookList
join ordr in bookOrders
on bk.BookID equals ordr.BookID
select new
{
BookID = bk.BookID,
BookNm = bk.BookNm,
PaymentMode = ordr.PaymentMode
}).AsQueryable().OrderBy(e.SortExpression,e.SortDirection);