Exemplo n.º 1
0
        public ActionResult GroupMemberIndex(int?page)
        {
            var all = db.sp_GroupMember_GetByAll().OrderByDescending(p => p.Name).ToList();

            int pageSize   = 2;
            int pageNumber = (page ?? 1);

            // Thiết lập phân trang
            PagedListRenderOptions pro = new PagedListRenderOptions();

            pro.DisplayLinkToFirstPage                      = PagedListDisplayMode.Always;
            pro.DisplayLinkToLastPage                       = PagedListDisplayMode.Always;
            pro.DisplayLinkToPreviousPage                   = PagedListDisplayMode.Always;
            pro.DisplayLinkToNextPage                       = PagedListDisplayMode.Always;
            pro.DisplayLinkToIndividualPages                = true;
            pro.DisplayPageCountAndCurrentLocation          = false;
            pro.MaximumPageNumbersToDisplay                 = 5;
            pro.DisplayEllipsesWhenNotShowingAllPageNumbers = true;
            pro.EllipsesFormat                     = "…";
            pro.LinkToFirstPageFormat              = "Trang đầu";
            pro.LinkToPreviousPageFormat           = "«";
            pro.LinkToIndividualPageFormat         = "{0}";
            pro.LinkToNextPageFormat               = "»";
            pro.LinkToLastPageFormat               = "Trang cuối";
            pro.PageCountAndCurrentLocationFormat  = "Page {0} of {1}.";
            pro.ItemSliceAndTotalFormat            = "Showing items {0} through {1} of {2}.";
            pro.FunctionToDisplayEachPageNumber    = null;
            pro.ClassToApplyToFirstListItemInPager = null;
            pro.ClassToApplyToLastListItemInPager  = null;
            pro.ContainerDivClasses                = new[] { "pagination-container" };
            pro.UlElementClasses                   = new[] { "pagination" };
            pro.LiElementClasses                   = Enumerable.Empty <string>();

            ViewBag.Pro = pro;

            return(View(all.ToPagedList(pageNumber, pageSize)));
        }