예제 #1
0
        private static void RenderNode(StringBuilder sb, MerchantTribe.Web.SiteMapNode node)
        {
            sb.Append("<li>");


            if (node.Url.Trim().Length > 0)
            {
                sb.Append("<a href=\"" + node.Url + "\">" + node.DisplayName + "</a>");
            }
            else
            {
                sb.Append("<strong>" + node.DisplayName + "</strong>");
            }

            if (node.Children.Count > 0)
            {
                sb.Append(System.Environment.NewLine);
                sb.Append("<ul>" + System.Environment.NewLine);

                foreach (MerchantTribe.Web.SiteMapNode child in node.Children)
                {
                    RenderNode(sb, child);
                }

                sb.Append("</ul>" + System.Environment.NewLine);
            }
            sb.Append("</li>" + System.Environment.NewLine);
        }
예제 #2
0
        public static string RenderSiteMap(MerchantTribe.Web.SiteMapNode nodes)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("<ul>" + System.Environment.NewLine);

            RenderNode(sb, nodes);

            sb.Append("</ul>" + System.Environment.NewLine);

            return(sb.ToString());
        }