Search code examples
asp.netfilterdataview

How to Apply Filters in DataView(To hide top 5 rows, to hide last 10 rows)


*Hi I want to hide top 5 rows/top 20/bottom 5...etc. How to filter in DataView. Please someone help me out to resolve this. Thanks in advance. *


Solution

  • You can use Linq.Check out below linq query.

    var result= dataView.ToTable().AsEnumerable().OrderBy(r => r["ID"]).Skip(5).ToList();
    

    For more information check out following msdn link

    http://msdn.microsoft.com/en-us/library/bb669073(v=vs.110).aspx