Book Image

Bootstrap for ASP.NET MVC - Second Edition

By : Pieter van der Westhuizen
Book Image

Bootstrap for ASP.NET MVC - Second Edition

By: Pieter van der Westhuizen

Overview of this book

One of the leading open source frontend frameworks, Bootstrap has undergone a significant change and introduced several features that make designing compelling, next-generation UIs much simpler. Integrating Bootstrap with ASP.NET's powerful components can further enhance its capabilities. This book guides you through the process of creating an ASP.NET MVC website from scratch using Bootstrap. After a primer on the fundamentals of Bootstrap, you will learn your way around and create a new ASP.NET MVC project in Visual Studio. You will move on to learn about the various Bootstrap components as well as techniques to include them in your own projects. The book includes practical examples to show you how to use open-source plugins with Bootstrap and ASP.NET MVC and guides you through building an ASP.NET MVC website using Bootstrap, utilizing layout and user-interface components. At the end of this book, you will find some valuable tips and tricks to help you get the most out of your Bootstrap-integrated and ASP.NET MVC-integrated website.
Table of Contents (15 chapters)
Bootstrap for ASP.NET MVC Second Edition
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface

Pagination


Pagination is used to divide content, usually lists, into separate pages. For example, when scaffolding a List view, the default scaffolding template generates a table that contains a row for each item in the collection you pass into the view. This is fine for small amounts of data, but if the list contains hundreds of items, your page will take a very long time to load. Ideally, you would like to split your list view into a manageable 5 to 10 items per page view.

In the first edition of this book we used the PagedList.Mvc NuGet package to make paging using Bootstrap 3 easier. This package is no longer maintained, but there is a drop-in replacement library available on NuGet called X.PagedList.

Unfortunately, neither NuGet Packages would work, because of their dependencies on System.Web, which was removed from ASP.NET Core. In the following example we'll use an open source library called cloudscribe.Web.Pagination to create a paged list using Bootstrap 4.

To create the paged list...