protected void rptLeftNav_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { e.Item.Visible = false; Acsys.Web.SiteMap.SiteMapNode node = e.Item.DataItem as Acsys.Web.SiteMap.SiteMapNode; if (node == null) { // Nothing logged here intentionally, if this happens something when sour with the site map // file and there'd already be something logged. No need to bloat event logs with too many // exceptions. return; } if (!node.Visible) { return; } HtmlAnchor link2 = (HtmlAnchor)e.Item.FindControl("link2"); HtmlGenericControl li2 = (HtmlGenericControl)e.Item.FindControl("liItem2"); if (link2 == null || li2 == null) { return; } if (!String.IsNullOrEmpty(node.Href)) { link2.HRef = node.Href; } if (!String.IsNullOrEmpty(node.NavigationTitle)) { link2.InnerText = node.NavigationTitle; } if (!String.IsNullOrEmpty(node.Target)) { link2.Target = node.Target; } if (currentNode.Equals(node) || currentNode.IsDescendantOf(node)) { li2.Attributes.Add("class", "active"); if (node.HasChildNodes) { Repeater t3 = (Repeater)e.Item.FindControl("t3Nav"); t3.ItemDataBound += rptTier3_ItemDataBound; t3.DataSource = node.ChildNodes; t3.DataBind(); } } e.Item.Visible = true; } }
protected void TopNav_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item == null || e.Item.DataItem == null) { return; } if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { e.Item.Visible = false; Acsys.Web.SiteMap.SiteMapNode node = (Acsys.Web.SiteMap.SiteMapNode)e.Item.DataItem; if (node == null) { Acsys.EventLogHelper.WriteToErrorLog("webapp", "Could not find the SiteMapNode with the name '" + Convert.ToString(e.Item.DataItem) + "' for the Top Navigation."); return; } if (node.Visible == false) { return; } HtmlAnchor link = (HtmlAnchor)e.Item.FindControl("link"); HtmlGenericControl ul = (HtmlGenericControl)e.Item.FindControl("ulSubMenu"); HtmlGenericControl item = (HtmlGenericControl)e.Item.FindControl("item"); Repeater rptT2 = e.Item.FindControl("rptT2") as Repeater; e.Item.ID = "_" + e.Item.ItemIndex.ToString(); if (link == null) { return; } menuCount++; if (item != null) { if (node.Equals(currentNode) || currentNode.IsDescendantOf(node)) { item.Attributes.Add("class", "current"); } else { item.Attributes.Add("class", node.Description); } } if (!String.IsNullOrEmpty(node.Href)) { link.HRef = node.Href; link.InnerText = node.NavigationTitle; } if (!String.IsNullOrEmpty(node.Target)) { link.Target = node.Target; } e.Item.Visible = true; if (VisibleChildCount(node) <= 0) { ul.Visible = false; rptT2.Visible = false; return; } if (VisibleChildCount((Acsys.Web.SiteMap.SiteMapNode)SiteMap.RootNode) == menuCount) { ul.Attributes.Add("style", "margin:0px 0px 0px -78px"); } rptT2.ItemDataBound += new RepeaterItemEventHandler(rptT2_ItemDataBound); rptT2.DataSource = node.ChildNodes; rptT2.DataBind(); } }