I have a checkboxlist in my C#/asp.net project and I’m populating it with a dataTable that gets data from a query to my database. The query returns a large amount of data and I want to restrict the number of elements that it shows initially before I filter the data. (To, say, the top 1000). How would I go about doing this?
Share
There are two places where you can limit the number of data.
In the database (assuming you use SQL Server) you can modify the query to return the top 1000 rows.
Or you can filter the data after it arrives using Linq.
I would prefer the first method, so you don’t truck around useless data. But the second definitely works as well if you need that data elsewhere.