PagedListRenderOptions :如何添加 FunctionToTransformEachPageLink page-link class?
PagedListRenderOptions : How can I add FunctionToTransformEachPageLink page-link class?
我需要帮助 asp.net;
当我如下添加 class 时,我的列表将 html 标签定义为字符串。
@Html.PagedListPager(Model, page =>
Url.Action("Index", new { page = page }),
new PagedListRenderOptions
{
UlElementClasses = new string[] { "pagination pagination-xs pagination-gutter pagination-warning" },
LiElementClasses = new string[] { "page-item" },
LinkToPreviousPageFormat = "Geri",
LinkToNextPageFormat = "İleri",
ClassToApplyToLastListItemInPager = "page-previus",
ClassToApplyToFirstListItemInPager = "page-next",
FunctionToTransformEachPageLink = (li, a) =>
{
a.AddCssClass("page-link");
li.SetInnerText(a.ToString());
return li;
}
})
我该如何修复它:
<ul class="pagination pagination-xs pagination-gutter pagination-warning">
1
2
Ileri
我修复了:li.InnerHtml = a.ToString();
@Html.PagedListPager(Model, page =>
Url.Action("Index", new { page = page }),
new PagedListRenderOptions
{
UlElementClasses = new string[] { "pagination pagination-xs pagination-gutter pagination-warning" },
LiElementClasses = new string[] { "page-item" },
LinkToPreviousPageFormat = "Geri",
LinkToNextPageFormat = "İleri",
ClassToApplyToLastListItemInPager = "page-previus",
ClassToApplyToFirstListItemInPager = "page-next",
FunctionToTransformEachPageLink = (li, a) =>
{
a.AddCssClass("page-link");
li.InnerHtml = a.ToString();
return li;
}
})
我需要帮助 asp.net; 当我如下添加 class 时,我的列表将 html 标签定义为字符串。
@Html.PagedListPager(Model, page =>
Url.Action("Index", new { page = page }),
new PagedListRenderOptions
{
UlElementClasses = new string[] { "pagination pagination-xs pagination-gutter pagination-warning" },
LiElementClasses = new string[] { "page-item" },
LinkToPreviousPageFormat = "Geri",
LinkToNextPageFormat = "İleri",
ClassToApplyToLastListItemInPager = "page-previus",
ClassToApplyToFirstListItemInPager = "page-next",
FunctionToTransformEachPageLink = (li, a) =>
{
a.AddCssClass("page-link");
li.SetInnerText(a.ToString());
return li;
}
})
我该如何修复它:
1
2
Ileri
<ul class="pagination pagination-xs pagination-gutter pagination-warning">
我修复了:li.InnerHtml = a.ToString();
@Html.PagedListPager(Model, page =>
Url.Action("Index", new { page = page }),
new PagedListRenderOptions
{
UlElementClasses = new string[] { "pagination pagination-xs pagination-gutter pagination-warning" },
LiElementClasses = new string[] { "page-item" },
LinkToPreviousPageFormat = "Geri",
LinkToNextPageFormat = "İleri",
ClassToApplyToLastListItemInPager = "page-previus",
ClassToApplyToFirstListItemInPager = "page-next",
FunctionToTransformEachPageLink = (li, a) =>
{
a.AddCssClass("page-link");
li.InnerHtml = a.ToString();
return li;
}
})