How to Pagination child item for Webpage?

2025/07/17 2:16 PM

I want to pagination child item in webpage, because if I have 100 child items i will show there , how to handle that?


Environment

  • Xperience by Kentico version: 30.6.0

  • .NET version: 9

  • Execution environment: [SaaS|Private cloud (Azure/AWS/Virtual machine)]

  • Attachment:

1.00

Tags:
Content querying Website channels

Answers

2025/07/17 5:01 PM

If you mean paginating the child items when querying the content for rendering, you can use the .Offset(skip, pageSize) to specify page of results you want, and .IncludeTotalCount() and GetTotalCount() to get the grand total.

However, it means you can't use GetMappedResult<T> instead you have to use GetWebPageResult which allows use to use the GetTotalCount() extension method on the result. After that, you can use the WebPageQueryResultMapper to map the results to generated types.

Here's an example:

contentItemQueryBuilder.Parameters(q => q
    .OrderBy(orderByColumns.ToArray())
    .Offset(skip, pageSize)
    .IncludeTotalCount()
);

var webpageResult = await _contentQueryExecutor.GetWebPageResult(
                                           contentItemQueryBuilder,
                                           contentItem => contentItem,
                                           options: contentQueryExecutionOptions);
var totalCount = webpageResult.Any()
                 ? webpageResult.First().GetTotalCount().GetValueOrDefault()
                 : 0;

var webPageItems = webpageResult
                        .Select(contentItem =>
                            (contentItem is IWebPageContentQueryDataContainer webItem)
                                ? _webPageQueryResultMapper.Map<T>(webItem)
                                : null)
                        .ToList<T?>().CastToNonNullable();

2025/07/18 1:20 AM

Hi Mike,

Thanks for your advise,

but I want pagination in webpage of Admin portal, like old Kentico,

Could you help check it? (sorry for my English)

1.00

Thanks

2025/07/18 1:24 PM

Hi hieuden0,

I find that Xperience by Kentico provides a much better experience for sites with a high volume of content, but it doesn't do it by providing paging in the Web Channel tree (sorry).

However, XbyK provides:

  • High-performance search in the content tree
  • Better performance in the admin
  • Ability for authors to organize pages in administrative folders that have no impact on URL, etc., like this:

So, I'd be inclined to train and help the customer organize their large child items into subfolders to "bucket" the list using the built-in channel folders.

I know this isn't what you were hoping for, but I hope it helps.

2025/07/22 2:19 PM

Hi hieuden0,

Just as Mike mentioned it. It is a best practice to organize content specially news/press releases/events or other type of content that uses dates in sub folders. An example of a better organization you can use:

Press Releases

  • 2025

    • January
    • February
    • ....
  • 2026

    • January
    • February
    • ....

And then if you publishing a lot of press releases or news in a single month, you can even split them by week of each month. This is totally up to you. However, this is the fastest way to find, organize data with a date in mind.

In addition, the new search capabilities for high-volume of content is really helpful as Mike mentioned it as well.

I hope this information helps you!

To answer this question, you have to login first.