What is the best/easiest way to bind a repeater for a specified number of times, so for example if my list has 10 items and I just want to bind the first 2 items (using C#).
+3
A:
Filter the list of items at the data level, as close to the source as possible.
So if you only intend to show 2 items, request data for only 2 items instead of 10. If that's not possible, take the original data source and only supply the first 2 items to the repeater.
Jon Seigel
2009-11-30 17:07:16
A:
SELECT TOP 2 * FROM Customer
Use the Keyword TOP to filter only the TOP N number of items...
For an example if you want only 4 most recently registered customers from a table Assuming there is a RegisteredDate attribute in your table...
SELECT TOP 4 * FROM Customer ORDER BY RegisteredDate DESC
Ranhiru Cooray
2010-03-26 08:29:20