private string makeItemMenu(PublicMenuTreeItem currentItem, int menuAccumulatedId, string menuAccum) { StringBuilder sb1 = new StringBuilder(); sb1.AppendFormat("\n<div class='menu{0}-div'>", currentItem.Depth); string menustatus = ""; if (currentItem.Id == Id) { menustatus = "_a"; } sb1.AppendFormat(" <a class='menu{0}-link{1}' href='{2}'>{3}</a></div>", currentItem.Depth, menustatus, currentItem.Url, currentItem.Text); foreach (PublicMenuTreeItem item in currentItem.Children) { if (item.Id == menuAccumulatedId) { sb1.Append(menuAccum); } else { sb1.AppendFormat("\n<div class='menu{0}-div'>", item.Depth); menustatus = ""; if (currentItem.Id == item.Id) { menustatus = "_a"; } sb1.AppendFormat(" <a class='menu{0}-link{1}' href='{2}'>{3}</a></div>", item.Depth, menustatus, item.url, item.Text); } } return(sb1.ToString()); }
public string GetMainMenuForDisplay() { StringBuilder sb = new StringBuilder(); PublicMenuTreeItem currMenu = this; int menuAccumulatedId = -2; string menuAccum = ""; while (currMenu != null) { menuAccum = makeItemMenu(currMenu, menuAccumulatedId, menuAccum); // + counter2++; menuAccumulatedId = currMenu.Id; currMenu = (PublicMenuTreeItem)currMenu.Parent; } return(menuAccum); }
public string GetMainMenuForDisplay() { PublicMenuTreeItem currentItem = (PublicMenuTreeItem)GetItem(CurrentId); return(currentItem.GetMainMenuForDisplay()); }