private static void CreateSubMenu(TagBuilder accordion, string menu, string userName) { TagBuilder h3; h3 = new TagBuilder("h3"); var a1 = new TagBuilder("a"); a1.Attributes["href"] = "#"; a1.InnerHtml = menu; h3.InnerHtml += a1.ToString(); TagBuilder h4; TagBuilder div; var accordionSub = new TagBuilder("div"); var extraDiv = new TagBuilder("div"); accordionSub.GenerateId("accordionSub"); UcbServiceClient sc = new UcbServiceClient(); try { var publishedReportsByCategory = sc.GetPublishedReportsByCategory(userName, userName, "Ucb", ""); foreach (var category in publishedReportsByCategory) { h4 = new TagBuilder("h4"); var a = new TagBuilder("a"); a.Attributes["href"] = "#"; a.InnerHtml = category.Category; div = new TagBuilder("div"); var ul = new TagBuilder("ul"); ul.GenerateId("nav"); foreach (var li in CreateSubMenuItem(category.StandardReports)) { ul.InnerHtml += li.ToString(); } div.InnerHtml = ul.ToString(); h4.InnerHtml += a.ToString(); accordionSub.InnerHtml += h4.ToString(); accordionSub.InnerHtml += div.ToString(); } } catch (Exception e) { string message = ExceptionManager.HandleException(e, sc); } finally { sc.Close(); } accordion.InnerHtml += h3.ToString(); extraDiv.InnerHtml += accordionSub.ToString(); accordion.InnerHtml += extraDiv.ToString(); }