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?

Vivek Nuna
  • 25,472
  • 25
  • 109
  • 197
Jiju John
  • 821
  • 3
  • 14
  • 35

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
  • 25,472
  • 25
  • 109
  • 197