Admin.Pages.EditPage.BuildChildPageList C# (CSharp) Метод

BuildChildPageList() приватный Метод

Builds the child page list.
private BuildChildPageList ( BlogEngine page ) : System.Web.UI.HtmlControls.HtmlGenericControl
page BlogEngine The page to make a child list for.
Результат System.Web.UI.HtmlControls.HtmlGenericControl
        private HtmlGenericControl BuildChildPageList(BlogEngine.Core.Page page)
        {
            var ul = new HtmlGenericControl("ul");
            foreach (var childPage in BlogEngine.Core.Page.Pages.FindAll(p => p.Parent == page.Id))
            {
                var cLi = new HtmlGenericControl("li");
                cLi.Attributes.CssStyle.Add("font-weight", "normal");
                var cA = new HtmlAnchor { HRef = string.Format("?id={0}", childPage.Id), InnerHtml = childPage.Title };

                var childText = new LiteralControl(string.Format(" ({0}) ", childPage.DateCreated.ToString("yyyy-dd-MM HH:mm")));

                const string DeleteText = "Are you sure you want to delete the page?";
                var delete = new HtmlAnchor { InnerText = labels.delete };
                delete.Attributes["onclick"] = string.Format("if (confirm('{0}')){{location.href='?delete={1}'}}", DeleteText, childPage.Id);
                delete.HRef = "javascript:void(0);";
                delete.Style.Add(HtmlTextWriterStyle.FontWeight, "normal");

                cLi.Controls.Add(cA);
                cLi.Controls.Add(childText);
                cLi.Controls.Add(delete);

                if (childPage.HasChildPages)
                {
                    cLi.Attributes.CssStyle.Remove("font-weight");
                    cLi.Attributes.CssStyle.Add("font-weight", "bold");
                    cLi.Controls.Add(this.BuildChildPageList(childPage));
                }

                ul.Controls.Add(cLi);
            }

            return ul;
        }