C # Paging Tool class, Perfect for list paging

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.