protected void btnNext_Click(object sender, EventArgs e) { if (this.DisplayRandomComment) { this.dlCommentText.DataSource = Utility.GetRandomItem(Comment.GetCommentsByItemId(this.ArticleId, ApprovalStatus.Approved.GetId())); } this.dlCommentText.DataBind(); }
private void DisplayComment() { // get cache var cacheKey = Utility.CacheKeyPublishArticleComments + this.ItemId.ToString(CultureInfo.InvariantCulture); var comments = Utility.GetValueFromCache( this.PortalId, cacheKey, () => Comment.GetCommentsByItemId(this.ArticleId, ApprovalStatus.Approved.GetId())); if (comments != null && comments.Count > 0) { this.lblNoComments.Visible = false; this.divPager.Visible = this.CommentDisplayOption == CommentDisplayOption.Paging; if (this.DisplayRandomComment) { this.dlCommentText.DataSource = Utility.GetRandomItem(comments); this.btnPrevious.Visible = false; } else { // if (CommentDisplayOption == CommentDisplayOptions.Paging) // PagedDataSource pagedComments = new PagedDataSource(); // pagedComments.DataSource = comments; // pagedComments.PageSize = CommentsPerPage; // dlCommentText.DataSource = pagedComments; // } // else // { this.dlCommentText.DataSource = comments; this.divPager.Visible = false; } this.dlCommentText.DataBind(); if (this.dlCommentText.Items.Count < 1) { this.divPager.Visible = false; } } else { this.divPager.Visible = false; this.lblNoComments.Visible = true; } }