Source code for the following post can be downloaded here.
Paging data is one of those basic things most, if not every developer will have to do from time to time.
In the following approach, we're going to use a ListView, DataPager and an ObjectDataSource to achieve this. Equally one can use a DataView and simply use it with an ObjectDataSource - I personally prefer the ListView, simply because I feel its a more flexible control.
Lets have a look at the ObjectDataSource first:
<asp:ObjectDataSource ID="obsFriends" runat="server"
SelectMethod="ViewFriends" TypeName="friends" EnablePaging="true">
Notice that we'll need a "SelectCountMethod", this method returns a count of the total rows that needs paging, the "SelectMethod" is the method that returns the actual rows.