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;
repItems.DataBind();
}
}
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
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…