usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingsystem.web;namespaceprojectprogress.bll{/// <summary> ///Paging Tool class/// </summary> /// <typeparam name= "T" ></typeparam> Public classPagingutil<t>: list<t> { Public intDatacount {Get;Set; }//Total Record Count Public intPageCount {Get;Set; }//Total Pages Public intPageNo {Get;Set; }//Current page number Public intPageSize {Get;Set; }//shows the number of records per page//do you have a previous page Public BOOLHaspreviouspage {Get{returnPageNo >1; } } //do you have the next page ? Public BOOLHasnextpage {Get{returnPageNo < This. PageCount; } } /// <summary> ///Construction Method/// </summary> /// <param name= "dataList" ></param> /// <param name= "pageSize" ></param> /// <param name= "PageNo" ></param> PublicPagingutil (list<t> dataList,intPageSize,intPageNo) { This. PageSize =pageSize; This. PageNo =PageNo; This. Datacount =Datalist.count; This. PageCount = (int) Math.ceiling (decimal) This. datacount/pageSize); This. AddRange (Datalist.skip (PageNo-1)*pageSize). Take (pageSize)); } }}
C # Paging Tool class, Perfect for list paging