Esempio n. 1
0
        private TagBuilder ParentTag(IParentItem parent)
        {
            var mainTag = new TagBuilder("li");

            var label = new TagBuilder("label");

            label.SetInnerText(parent.MenyText());
            label.AddCssClass(" nav-header");


            var editButtons = new TagBuilder("div");

            if (parent is IEditableItem && ShowEdit)
            {
                editButtons.InnerHtml += EditTag((IEditableItem)parent);
            }



            var children = new TagBuilder("ul");

            foreach (var child in parent.ToList())
            {
                children.InnerHtml += BuildHtml(child);
            }


            mainTag.InnerHtml += SetColoumns(label, editButtons, MakeRow(new TagBuilder("div")));
            mainTag.InnerHtml += MakeRow(children);



            return(mainTag);
        }
Esempio n. 2
0
        public static List <IParentItem> GetAllChildren(IParentItem parent)
        {
            var list = new List <IParentItem>();

            foreach (var child in parent.ToList())
            {
                if (child is IParentItem)
                {
                    list.Add((IParentItem)child);
                    list = list.Concat(GetAllChildren((IParentItem)child)).ToList();
                }
            }

            return(list);
        }