dncuug / X.PagedList

Library for easily paging through any IEnumerable/IQueryable in ASP.NET
https://andrew.gubskiy.com/open-source
MIT License
899 stars 213 forks source link

FunctionToTransformEachPageLink #213

Closed hn1 closed 1 year ago

hn1 commented 3 years ago

We are trying to use the FunctionToTransformEachPageLink but it does not work. Here is the following code: (P.S. on the li we also do not egt the option of InnerHTML. The resulting render for each li looks something like this: Microsoft.AspNetCore.Mvc.Rendering.TagBuilder i.e. the class name as opposed to a Html li element and anchor

new PagedListRenderOptions
        {
            MaximumPageNumbersToDisplay = 10,
            Display = PagedListDisplayMode.IfNeeded,
            LiElementClasses = new string[] { "pagination" },
            NextElementClass = "next",
            LinkToPreviousPageFormat = "❮",
            LinkToNextPageFormat = "❯",
            LinkToFirstPageFormat = "❮❮",
            LinkToLastPageFormat = "❯❯",
            FunctionToTransformEachPageLink = (li, a) =>
            {
                a.AddCssClass("next");
                li.SetInnerText(a.ToString());
                return li;

            }
        })