I've got what I think is a simple request, but I'm so far unable to figure it out. I have a path to a document (ex: "/Product/Category") and I'd like to, via the code-behind, get the document name of the first child underneath that path. How do I do this?
Kentico 10.0 ASPX Templates + Portal
.CS:
TreeNode tn = ... string name = tn.Parent.Children.FirstItem.DocumentName;
macro:
name = Documents["/Product/Category"].Parent.Children.FirstItem.DocumentName;
I need to use this in a code-behind, so the macro is right out. When I use your c# code, I get the following error:
Cannot implicitly convert type 'string' to 'CMS.DocumentEngine.TreeNode'
I was able to take a different approach. Instead of using the path, I referenced the particular page type (all pages of which exist under the given path) as follows:
DocumentHelper.GetDocuments([page type]).OrderBy("NodeOrder").FirstObject.NodeAlias;
Please, sign in to be able to submit a new answer.