Hi all,
I'm building a custom macro for a web part, under the "No data behavior" section/field. The goal of the macro is to look at the child nodes of the current document (if there are any child nodes), and to display text in the "no record found text" field," depending on the document type of the child nodes.
My problem is this: I can't for the life of me figure out how to extract the document types of the child nodes from a dataset. My thinking was that the child node info was somehow stored in the tables of the dataset, and that each child node was essentially a row within [dataset].tables[0]. But for some reason, there are no rows - even when a number of child nodes definitely exist under the parent node.
Please take a look at the following code. I'd appreciate it if you pointed me in the right direction.
public static string ResolveCustomMacro(MacroResolver sender, string expression, out bool match)
{
bool childNodeIsProduct = false;
CMS.CMSHelper.ContextResolver aTempObject = (CMS.CMSHelper.ContextResolver) sender;
CMS.TreeEngine.TreeNode currentNode = aTempObject.CurrentDocument;
DataSet db;
CMS.TreeEngine.TreeProvider theTree = new CMS.TreeEngine.TreeProvider();
db = theTree.SelectNodes("shuki", currentNode.NodeAliasPath + "/%", currentNode.DocumentCulture, false);
if (db.Tables.Count == 0)
childNodeIsProduct = true;
else
{
DataRowCollection rows = db.Tables[0].Rows;
foreach (DataRow row in rows)
{
//it never gets in here because for some bloody reason there are never
//any rows
}
}
Thank you for your help!