- By John Belthoff
- In Asp.Net Articles
- Posted January 25, 2016
Asp.Net Bootstrap Pagination with Google "like" Logic
Pagination, like shown in the image above, has always been a little tricky. What's even trickier is getting it to behave like Google's pagination where the inner pages stay in the middle.
However with Bootstrap and a little logic, making great paginations are easier than ever!
I'll have to give credit where credit is due because I got the logic from Jason Watmore, particularly this blog: ASP.NET MVC - Pagination Example with Logic like Google. This article simply ports his Asp.Net MVC code to Webforms code. I hope you find it useful.
A working sample of this code is located here: Asp.Net Bootstrap Pagination Sample
Here is my code
A single Asp.Net Literal control renders the content and the code behind builds up the content from a StringBuilder object. The logic is derived from the Pager object.