I bind a datatable that contains data from a SOAP call. Unfortunately, the call returns all records for whatever entity i’m fetching and there’s no way at the moment of specifying number of records to return or any other argument.
How could I most efficiently sort this datatable by a date column and bind it to a grid while only showing the top 10 records?
You can use a
DataViewso that you can sort and take only the top 10 records.basically instead of binding the grid to the
DataTableyou filter/sort yourDataViewand bind the grid to theDataView.see this question and answers for details, it looks very similar: Select top N rows AFTER sorting from Dataview in c#