Posts

Showing posts with the label PagedList Pager

Donate

ASP.NET MVC Multiple PagedList Pager In A Single View

Image
Good afternoon! In a situation wherein a single page will contain multiple paging such as displaying master-details records or similar requirements, using a couple or more PagedList pager will cause logical errors such as when you click on the paging of details record to traverse to the next page, the paging of master record will move to the next record as well. In order to solve this dilemma, we need to assign a specific page variable to a PagedList object to prevent this issue from happening. In this example, I'll demonstrate showing products information from AdventureWorks database whose stocks are above or below a certain reorder point. The page model class below has two page properties namely BelowReorderPage and AboveReorderPage . And these properties are assigned to their specific PagedList object whether ProductsBelowReorder or ProductsAboveReorder . PageModel.cs public class PageModel { public int BelowReorderPage { get ; set ; } public int AboveReorderPage {

DataList In ASP.NET MVC With Paging Using PagedList And Bootstrap

Image
Here's an example ASP.NET MVC application that shows information in a DataList layout with pagination using PagedList Pager. The project also integrates Bootstrap for enhancing the UI and display the images from AdventureWorks Products table through an ImageHandler class. The significant files used in this project are: 1. PagingModel.cs/IndexModel.cs - These classes are responsible for defining the page number, size of page, and PagedList property that stores the information that are paged accordingly to it's size. public class PagingModel { public PagingModel () { Size = 24 ; Page = 1 ; } public int Page { get ; set ; } public int Size { get ; set ; } } public class IndexModel { public PagingModel PageModel { get ; set ; } public IndexModel (PagingModel pageModel) { Products = new PagedList<ProductViewModel>( new List<ProductViewModel>(), 1 , pageModel.Size); PageModel = pageModel; } public IPagedList<ProductViewModel>

Donate