App_Code.Controls.RelatedPosts.RenderControl C# (CSharp) Method

RenderControl() public method

Outputs server control content to a provided object and stores tracing information about the control if tracing is enabled.
public RenderControl ( System.Web.UI.HtmlTextWriter writer ) : void
writer System.Web.UI.HtmlTextWriter /// The object that receives the control content. ///
return void
        public override void RenderControl(HtmlTextWriter writer)
        {
            if (!BlogSettings.Instance.EnableRelatedPosts || this.Item == null)
            {
                return;
            }

            if (!RelatedPostsCache.ContainsKey(this.Item.Id))
            {
                var relatedPosts = Search.FindRelatedItems(this.Item);
                if (relatedPosts.Count <= 1)
                {
                    return;
                }

                this.CreateList(relatedPosts);
            }

            writer.Write(RelatedPostsCache[this.Item.Id].Replace("+++", this.Headline));
        }