Hi,
I am trying to get collection of leaf nodes from tree node collection. I have defined some fields in Page type form. I am trying to retrieve these field values using ValidationHelper.GetString.
For current document I am able to get value using this
TreeNode doc = DocumentContext.CurrentDocument; string temp = ValidationHelper.GetString(doc.GetValue("DisplayAt"), "", "");
But for other leaf node I am not able to get field values. It returns empty string.
TreeProvider tree = new TreeProvider(MembershipContext.AuthenticatedUser); TreeNode rootPage = tree.SelectNodes().Path("/").OnCurrentSite().FirstObject;
TreeNodeCollection collection = rootPage.AllChildren.WithAllData; foreach (var v in collection) { if (v.NodeHasChildren && v.IsRoot() == false) { foreach (var leaf in v.Children) { TreeNode t = tree.SelectNodes().Path(leaf.NodeAliasPath).OnCurrentSite().FirstObject; string someString= ValidationHelper.GetString(leaf.GetValue("Somevalue"), "", ""); string[] str1 = someString.Split('|'); foreach (string s in str1 ) { if (s.Equals(CurrentSite.SiteName)) { LeafNodeList.Add("~" + leaf.NodeAliasPath); coll.Add(leaf); if (leaf.DocumentGUID == doc.DocumentGUID) currentIndex = LeafNodeList.IndexOf("~" + leaf.NodeAliasPath); } } } } }
Kindly help. Thanks in advance. Manmath.
Page type fields are available only when you specify the class name, e.g.:
tree.SelectNodes("cms.menuitem")
Please, sign in to be able to submit a new answer.