I'm quite new to EPiServer so maybe there is a really easy solution to my problem, but I can't find any good information about this.
In a current project there is a demand that the editor should be able to add document lists on pages. These document lists should be able to list files and subfolders in the selected folder.
I was thinking that I could create a nested ul-list and expand/minimize the folders when the user clicks them.
My problem is how do I loop through content folders and their subfolders and create links to the files that are inside?
Can I use a ContentReference property to get a reference to the top-level folder and then loop through all the childnodes?
Should I create a custom object (like below) and render that in the Block View or is there a better way?
public class Folder {
public string Name{get; set;}
public IENumerable Files {get; set;}
public IENumerable ChildFolders {get; set;}
}
ContentRepository is able to work with Media folders as well. Just loop through child elements and build up your object graph out of what you have in media folders.
I'm quite new to EPiServer so maybe there is a really easy solution to my problem, but I can't find any good information about this.
In a current project there is a demand that the editor should be able to add document lists on pages. These document lists should be able to list files and subfolders in the selected folder.
I was thinking that I could create a nested ul-list and expand/minimize the folders when the user clicks them.
My problem is how do I loop through content folders and their subfolders and create links to the files that are inside?
Can I use a ContentReference property to get a reference to the top-level folder and then loop through all the childnodes?
Should I create a custom object (like below) and render that in the Block View or is there a better way?