Refresh Software Support Center

Contact Support
 

Email:
support@refreshsoftware.com

Phone:
508-318-4480


  Link to this page

Home >  Publishing Examples >  dotNET C# (.aspx) >  .Net Navigation Example

.Net Navigation Example

NavLabel.Text = GetNav(contentDomain.GetContentAssetByName("navParentNodde"));


         public string GetNav(ContentAsset asset)

        {

            StringBuilder html = new StringBuilder();

            html.Append("<ul>");

            foreach (string childName in asset.Children)

            {

                ContentAsset child = contentDomain.GetContentAssetByName(childName);

                html.Append("<li><a href=\"").Append(child.Link).Append("\">").Append(child.Title).Append("</a>");

                if (child.Children.Count > 0)

                {

                    foreach (string grandChildName in child.Children)

                    {

                        ContentAsset grandChild = contentDomain.GetContentAssetByName(grandChildName);

                        html.Append(GetNav(grandChild));

                    }

                }

                html.Append("</li>");

            }

            html.Append("</ul>");

 

            return html.ToString();

        }