views:

141

answers:

1

I have a ListView bound to a Generic List collection.

I need to be able to limit the number of items bound to something like 5, and show a more button in the template.

I can handle the DataBinding event, and remove the last few items in the List<>, but something about that doesn't feel right. I also can't limit the list to 5 beforehand, because I need to know that there are more than 5, to show the "more" button.

Any ideas? Thanks!

+2  A: 

Databind the list to

yourlist.Take(5);

(i.e. the LINQ operator), but perform the check for the more button based on the original list.

Richard