Almost a year ago, I wrote a post explaining how CTE (Common Table Expressions) can make your life much easier when working with your membership users in chunks and pages in SharePoint (or ASP.NET). Well, since then I have received couple emails from people asking for the UI part of that post (SPGridView) so I decided to write another follow up post here to demonstrate how to use SPGridView, SPGridViewPager and Common Table Expression to achieve a true pagination through your membership users.
Well, We all know that pagination has been always a very common feature when displaying and working with data in an application. The GridView control in ASP.NET 2.0 (my Swiss army control to display and work with data) offers a great support for standard paging with small data sets but when it comes to larger sets of data, things can get a bit funky (It pulls all the data back to the client by default). Back in good old ASP.NET 1.1 days, DataGrid control used to expose a property called VirtualItemCount that defines the number of records/items when custom paging is used. Unfortunately, this is missing in the GridView control!