November Happy Hour will be moved to Thursday December 5th.
AI OnAI Off
November Happy Hour will be moved to Thursday December 5th.
Actually, the same problem has occurred to me; FileSystemDataSource is used in the legacy code (for a TreeView), but does not exist for the new Media-based file system.
Here's some code to work on as a base (it lacks icons and sorting):
public class Root : IHierarchicalEnumerable { public ContentReference RootLink { get; set; } public Root(ContentReference rootLink) { RootLink = rootLink; } public IEnumerator GetEnumerator() { return new List<IContent> { DataFactory.Instance.Get<IContent>(RootLink) }.GetEnumerator(); } public IHierarchyData GetHierarchyData(object obj) { return new Node((IContent)obj, null); } } public class Children : IHierarchicalEnumerable { public Node ParentNode { get; set; } public Children(Node parentNode) { ParentNode = parentNode; } public IEnumerator GetEnumerator() { return ParentNode.Content.ContentLink.GetChildren<IContent>().GetEnumerator(); } public IHierarchyData GetHierarchyData(object obj) { return new Node((IContent)obj, ParentNode); } } public class Node : IHierarchyData { public IContent Content { get; set; } public Node Parent { get; set; } public Node(IContent content, Node parent) { Content = content; Parent = parent; } public bool HasChildren { get { return DataFactory.Instance.GetChildren<IContent>(Content.ContentLink).Any(); } } public object Item { get { return Content; } } public string Path { get { var node = this; var str = string.Empty; do { if(str != string.Empty) { str += "/"; } str += node.Content.Name; } while ((node = node.Parent) != null); return str; } } public string Type { get { return Content.GetType().Name; } } public IHierarchicalEnumerable GetChildren() { return new Children(this); } public IHierarchyData GetParent() { return Parent; } }
How to use it:
FileTree.DataSource = new Root(content.ContentLink); FileTree.DataBind();
Hello!
I ett uppgraderingsprojekt till EPiServer 7.5 används FileSystemDataSource-kontrollen för att lista filer i en asp:TreeView. Detta fungerar inte för nya mediaystemet eftersom FSDS-kontrollen är byggd för UFS. Finns det en ny kontroll för detta eller är det roll-your-own-dags?
Någon som stött på samma problem?
Gracias.