protected void Page_Load(object sender, EventArgs e) { Guid topic; Guid?typeId = null; bool hasFeatured = false; bool.TryParse(Featured, out hasFeatured); if (!string.IsNullOrEmpty(Type)) { try { typeId = Guid.Parse(Type); } catch { } } int page; Sitecore.Globalization.Language language; if (Sitecore.Globalization.Language.TryParse(Lang, out language)) { Sitecore.Context.SetLanguage(language, false); } if (Guid.TryParse(Topic, out topic) && int.TryParse(ResultPage, out page)) { Item item = Sitecore.Context.Database.GetItem(Sitecore.Data.ID.Parse(topic)); if (item != null && item.InheritsTemplate(SubtopicLandingPageItem.TemplateId)) { SubtopicLandingPageItem topicItem = item; bool hasMoreResults; // Handle featured search if (!typeId.HasValue && hasFeatured) { articleListing.Articles = topicItem.GetFeaturedArticles(page, out hasMoreResults); } else { // Handle popular filter if (typeId == Guid.Empty) { articleListing.Articles = topicItem.GetPopularArticles(page, out hasMoreResults); } else { articleListing.Articles = topicItem.GetArticles(page, typeId, out hasMoreResults); } } phMoreResults.Visible = hasMoreResults; } } else { articleListing.Visible = false; } }
protected void rptTopicHeader_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.IsItem()) { SubtopicLandingPageItem subTopicItem = e.Item.DataItem as SubtopicLandingPageItem; HyperLink hlNavigationTitle = e.FindControlAs <HyperLink>("hlNavigationTitle"); BasePageNEWItem basePageNewItem = new BasePageNEWItem(subTopicItem); if (hlNavigationTitle != null) { // Handle overview link if (subTopicItem.InnerItem != Sitecore.Context.Item) { hlNavigationTitle.NavigateUrl = subTopicItem.InnerItem.GetUrl(); hlNavigationTitle.Text = basePageNewItem.NavigationTitle.Rendered; } else { HtmlGenericControl liNav = e.FindControlAs <HtmlGenericControl>("liNav"); liNav.Visible = false; } } } }