public static String MenuItem(MenuItem item) { var builder = new StringBuilder(); builder.Append(@"<li class=""dropdown"">"); builder.AppendFormat(@"<a href=""#"" class=""dropdown-toggle"" data-toggle=""dropdown""><span>{0}</span> <b class=""caret""></b></a>", item.Text); builder.Append(@"<ul class=""dropdown-menu"">"); foreach (var submenu in item.Submenus) { builder.Append(GenerateSubMenuItem(submenu)); } builder.Append("</ul></li>"); return builder.ToString(); }
public static String LinkItem(MenuItem item) { return LinkItem(item.Text, item.Url, item.Target); }
public MenuItem() { Submenus = new MenuItem[0]; }
public static String MenuItem(MenuItem item) { return string.Format(Template, item.CssClass, LinkBuilder.LinkItem(item)); }
private static string GenerateSubMenuItem(MenuItem item) { return item.IsDivider ? ListItemBuilder.DividerItem() : ListItemBuilder.MenuItem(item); }