private string submenu(long Id, int level) { var list = Dao.ViewByParent(Id); string output = ""; if (list.Count() > 0) { if (level > 0) { output += "<ul class=\"nav nav-sub-" + level + "\">"; } else { output += "<ul class=\"nav\">"; } foreach (var item in list) { output += "<li>"; output += "<a title=\"" + item.Text + "\" href=\"/" + item.Url + "\">"; output += item.Text; output += "</a>"; output += submenu(item.Id, level + 1); output += "</li>"; } output += "</ul>"; } return(output); }