if I provide the data query as properties of the CMSRepeater, the repeater shows all items (published or not) in preview mode and only published items on the live site.
However, if I try to pass a datasource to the repeater, I can't get it to do the same thing.
Is there some property or method I'm missing?Works @cms:CMSRepeater ID="rep2" runat="server" EnableViewState="true"
Path="./%" OrderBy="NodeOrder ASC"
MaxRelativeLevel="1"
ClassNames="MyClassName"
SelectedColumns="Col1, col2, etc"@
@/cms:CMSRepeater@
Does Not Workprivate DataSet LoadRepeaterItemsWithoutCache()
{
var columns = @"col1,col2";
var path ="./%";
TreeProvider tree = new TreeProvider();
return tree.SelectNodes("MyClassName")
.OnCurrentSite()
.Path(path)
.OrderBy("NodeOrder")
.NestingLevel(1)
//.Published(true/false)
//.CheckPermissions(true/false)
.CombineWithDefaultCulture(false)
.Columns(columns);
}
var tnds = LoadRepeaterItemsWithoutCache();
rep2.DataBindByDefault = false;
rep2.HideControlForZeroRows = true;
if (!DataHelper.DataSourceIsEmpty(tnds))
{
rep2.DataSource = tnds;
rep2.DataBind();
}
↧