0

Is there any way to apply skip and take in Datatable in asp.net core 2.0. without converting to any class type? I have used stored procedure to get data and convert to Datatable, I want to apply pagination in this Table, how can I do this?

Jiju John
  • 783
  • 3
  • 11
  • 33

1 Answers1

1

You can not use becuase it does not implement the IEnumerable<T>. But you can do this by using AsEnumerable extension method.

DataTable dt = new DataTable();
IEnumerable<DataRow> rows = dt.AsEnumerable().Skip(10).Take(10);

Above solution works for .Net Core version >= 3

For .Net Core version 2. You need to install the package.

System.Data.DataExtensions
vivek nuna
  • 16,885
  • 12
  • 74
  • 152