Exemple #1
0
        protected void rptTopicListItems_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.IsItem())
            {
                DefaultArticlePageItem item = (DefaultArticlePageItem)e.Item.DataItem;

                HyperLink hlTopicTitle = e.FindControlAs <HyperLink>("hlTopicTitle");
                hlTopicTitle.NavigateUrl = item.GetUrl();
                hlTopicTitle.Text        = item.ContentPage.PageTitle.Rendered;

                PlaceHolder phThumbnail = e.FindControlAs <PlaceHolder>("phThumbnail");

                var icons = e.FindControlAs <UnderstoodDotOrg.Web.Presentation.Sublayouts.Recommendation.ArticleRecommendationIcons>("ArticleRecommendationIcons");
                if (icons != null)
                {
                    icons.MatchingChildrenIds       = item.GetMatchingChildrenIds(CurrentMember);
                    icons.HasMatchingParentInterest = item.HasMatchingParentInterest(CurrentMember);
                }

                // Handle first image
                if (e.Item.ItemIndex == 0)
                {
                    Image  imgThumbnail = e.FindControlAs <Image>("imgThumbnail");
                    string source       = item.GetArticleFeaturedThumbnailUrl(190, 107);
                    imgThumbnail.ImageUrl = source;
                    phThumbnail.Visible   = !String.IsNullOrEmpty(source);
                }
                else
                {
                    phThumbnail.Visible = false;
                }
            }
        }
Exemple #2
0
        protected void rptFeaturedArticles_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.IsItem())
            {
                DefaultArticlePageItem article = e.Item.DataItem as DefaultArticlePageItem;

                HyperLink hypArticleLink = e.FindControlAs <HyperLink>("hypArticleLink");
                Literal   ltArticleText  = e.FindControlAs <Literal>("ltArticleText");
                System.Web.UI.WebControls.Image imgThumbnail = e.FindControlAs <System.Web.UI.WebControls.Image>("imgThumbnail");

                hypArticleLink.NavigateUrl = article.GetUrl();
                // TODO: verify this truncation is allowed
                ltArticleText.Text    = article.ContentPage.BasePageNEW.NavigationTitle.Raw.Truncate(50, true, true);
                imgThumbnail.ImageUrl = article.GetArticleFeaturedThumbnailUrl(230, 129);
            }
        }
        protected void rptTopicCarousel_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.IsItem())
            {
                DefaultArticlePageItem item = e.Item.DataItem as DefaultArticlePageItem;

                System.Web.UI.WebControls.Image imgFeatured = e.FindControlAs <System.Web.UI.WebControls.Image>("imgFeatured");
                imgFeatured.ImageUrl = item.GetArticleFeaturedThumbnailUrl(630, 354);

                Literal litNavigationTitle = e.FindControlAs <Literal>("litNavigationTitle");
                litNavigationTitle.Text = item.ContentPage.BasePageNEW.NavigationTitle.Rendered;

                HyperLink hlImageLink = e.FindControlAs <HyperLink>("hlImageLink");
                hlImageLink.NavigateUrl = item.GetUrl();
            }
        }