Exemplo n.º 1
0
        private void ProductsList_ItemDataBound(object sender, Telerik.Web.UI.RadListViewItemEventArgs e)
        {
            if (e.Item is RadListViewDataItem)
            {
                HtmlControl    heading3     = e.Item.FindControl("ProductTitle") as HtmlControl;
                DynamicContent productItem  = ((RadListViewDataItem)e.Item).DataItem as DynamicContent;
                string         productTitle = String.Empty;

                if (productItem != null)
                {
                    productTitle = productItem.GetString("Title");
                }

                if (heading3 != null)
                {
                    if (productTitle.StartsWith("EU"))
                    {
                        HtmlGenericControl span = new HtmlGenericControl("span");
                        span.Attributes.Add("class", productNameSpanClass);
                        string  firstPart  = productTitle.Substring(0, 2);
                        string  secondPart = productTitle.Substring(2);
                        Literal literalEU  = new Literal();
                        literalEU.Text = firstPart;
                        heading3.Controls.Add(literalEU);

                        span.InnerText = secondPart;
                        heading3.Controls.Add(span);
                    }
                    else
                    {
                        Literal productTitleLtl = new Literal();
                        productTitleLtl.Text = productTitle;
                        heading3.Controls.Add(productTitleLtl);
                    }
                }

                //Add NavigateUrl to Policy Coverage link
                HyperLink policyCoverageLink     = e.Item.FindControl("PolicyCoverageLink") as HyperLink;
                PageNode  policyCoveragePageNode = productItem.GetValue("PolicyCoverageLandingPage") as PageNode;

                if (policyCoverageLink != null && policyCoveragePageNode != null)
                {
                    policyCoverageLink.NavigateUrl = PagesUtilities.GetPageUrlByPageNode(policyCoveragePageNode);
                }

                //Add NavigateUrl to Read More link
                HyperLink readMoreLink     = e.Item.FindControl("ReadMoreLink") as HyperLink;
                PageNode  readMorePageNode = productItem.GetValue("ReadMoreLandingPage") as PageNode;

                if (readMoreLink != null && readMorePageNode != null)
                {
                    readMoreLink.NavigateUrl = PagesUtilities.GetPageUrlByPageNode(readMorePageNode);
                }
            }
        }