AlexanderKrutov / DataTables.Queryable

.Net library for clever processing of requests from datatables.net jQuery plugin on the server side (ASP.NET, Nancy or any other web server).
MIT License
50 stars 19 forks source link

"paging" option causes exception #2

Closed AlexanderKrutov closed 7 years ago

AlexanderKrutov commented 7 years ago

If paging option is enabled for DataTable, servere-side code throws an ArgumentException:

Limit must have a non-negative value.

It happens because of takeCount parameter. Value of the takeCount parameter obtained from pageSize DataTables query parameter which is negative (i.e. -1) when pagination is disabled.

queryable.Skip(skipCount).Take(takeCount).ToList()

How to fix: handle negative values of pageSize query parameter.