Any update on this?
I have a similar scenario, where previously we used a CMSRepeater with a Path query.
However, now we want to manually filter the data, so I though that constructing a TreeNode from the DataRow would solve it, but unfortunately keep getting:
[CMSAbstractTransformation.DataBind]: Object reference not set to an instance of an object.
Probably cause the transformation methods (e.g. GetDocument) are not working.
The helper method that queries for the next property:public static object GetNextProperty(TreeNode currentProperty)
{
TreeProvider tree = new TreeProvider();
var ds = tree.SelectNodes(CMSContext.CurrentSiteName, currentProperty.Parent.NodeAliasPath + "%",
CMSContext.CurrentDocumentCulture.CultureCode, true, "Custom.Property");
if (!DataHelper.DataSourceIsEmpty(ds)
&& ds.Tables[0].Rows.Count > 1)
{
int i = 0;
foreach (DataRow item in ds.Tables[0].Rows)
{
if (item["NodeAliasPath"].ToString() == currentProperty.NodeAliasPath)
break; // current!
i++;
}
i = i + 1; // next!
if (i >= ds.Tables[0].Rows.Count) // last?
i = 0; // first!
return new TreeNode[] { TreeNode.New(ds.Tables[0].Rows, "Custom.Property", tree) };
}
return null;
}
The repeater in a web part <cms:CMSRepeater ID="repRelated" runat="server"
TransformationName="Custom.Property.propertylistitem_other"
DelayedLoading="true" DataBindByDefault="false" />
The method to bind the repeater invoked in the web parts Page_Load eventprivate void BindRepeater()
{
repRelated.DataSource = PropertyFunctions.GetNextProperty(CurrentDocument);
repRelated.ReloadData(true);
}
The transformation "Custom.Property.propertylistitem_other":
<div class="property-other">
<a href="<%# GetPropertyDetailUrl(true) %>"><%# IfImage("PropertyThumbnail", GetImage("PropertyThumbnail", 220), "<img src=\"~/App_Themes/Custom/Images/property_no_image.jpg\" alt=\"" + HTMLEncode(Eval("PropertyTitle").ToString()) + "\" />") %></a>
<div class="clearfix">
<%# IfId(Eval("PropertyAreaId"), "<h3 class='left'>" + GetPropertyAreaName(Eval("PropertyAreaId")) + "</h3>") %>
<h3 class="right"><%# GetPropertyPriceFormatted()%></h3>
</div>
<h2><a href="<%# GetPropertyDetailUrl(true) %>"><%# HTMLEncode(Eval("PropertyTitle").ToString()) %></a></h2>
</div>
Any help on trying to get the transformations to work on a manually bound repeater would be great!