protected void btnSearch_Click(object sender, EventArgs e) { Panel panResultText = (Panel)FindControl("panResultText"); panResultText.Visible = true; Literal litResultCount = (Literal)FindControl("litResultCount"); Literal litSearchTerm = (Literal)FindControl("litSearchTerm"); Repeater rptRecentBlogInfo = (Repeater)FindControl("rptRecentBlogInfo"); string query = TextHelper.RemoveHTML(txtSearch.Text); var dataSource = TelligentService.CommunitySearch(query, Constants.TelligentSearchParams.Blog, Constants.BlogNames[Sitecore.Context.Item["BlogId"]]); litSearchTerm.Text = query; if (dataSource.Any()) { foreach (var item in dataSource) { string[] s = item.Title.Split('{'); BlogsPostPageItem blogPost = Sitecore.Context.Database.GetItem(String.Format("{0}{1}", "{", s[1])); if (blogPost != null) { item.Title = s[0].Trim(); if (!item.Title.ToLower().Contains("comment on")) { item.Body = Sitecore.StringUtil.RemoveTags(TelligentService.FormatString100(blogPost.Body)); } BlogsAuthorPageItem author = Sitecore.Context.Database.GetItem(blogPost.Author.Raw); if (author != null) { item.Author = author.Name; } else { item.Author = null; } var telligentDetails = TelligentService.ReadBlogBody(blogPost.BlogId, blogPost.BlogPostId); item.CommentCount = telligentDetails.CommentCount; } } } litResultCount.Text = dataSource.Count.ToString(); rptRecentBlogInfo.DataSource = dataSource; rptRecentBlogInfo.DataBind(); }