Kentico CmsRepeater: When to call databind when DataBindByDefault=”false”

I want to set DataBindByDefault to false on my repeater because otherwise it makes a call to the db which returns all data from the child nodes of the page which comes to 12MB.

I’ve hacked it for now and set the Path value to “.” (same page only) in the code in front but it’s still an extra db call.

So my plan was to set DataBindByDefault to false, assign the data from my custom query to the repeater and then call databind() as follows:

<cms:CMSRepeater ID="repItems" runat="server" Path="."/>

private void InitRepeater()
    var data = (DataSet)NewsProvider.GetNews(ClassNames, Path, MaxRelativeLevel, OrderBy, WhereStatement, SelectTopN, -1, -1);
    if (!DataHelper.DataSourceIsEmpty(data))
        repItems.DataSource = data;
        repItems.ControlContext = ControlContext;
        repItems.EnablePaging = true;
        repItems.PageSize = PageSize;
        repItems.PagerControl.CurrentPage = 1;
        repItems.PagerControl.PageSize = PageSize;
        repItems.PagerControl.Visible = false;
        repItems.HideControlForZeroRows = true;
        repItems.TransformationName = Transformation;

InitRepeater() is called from SetupControl() which called from OnContentLoaded() and ReloadData() but nothing gets rendered.

If I try calling InitRepeater() in PreRender it renders but it ignores the paging settings.

I’m using Kentico v12.0.65


Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

You should be using the LoadPagesIndividually property of the repeater control. If true, each page is loaded individually in case of paging.

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x