hi, I need to display titles of all blogposts sorted by viewCount desc in one list and by commentsCount desc in another list. I have the following, but doesnt seem to work.....what am I doing wrong here......
protected void getBlogPosts()
BlogsManager blogsManager = BlogsManager.GetManager();
List<BlogPost> postsList = blogsManager.GetBlogPosts().Where(t => t.Status==ContentLifecycleStatus.Live).ToList();
for (int i = 0; i < maxItemstoShow; i++)
BlogPost post = postsList[i];
int commentsCount = post.Comments.Count;
int viewCount = post.ViewsCount;
plhBlogsList.Controls.Add(new LiteralControl("<div class=\"post_titles_container\"><div class=\"newsitem\"><a href='/news/" + post.ItemDefaultUrl + "'>" + post.Title + "</a></div></div>"));
commentsCount and viewCount always return 0, even when I have comments and views for a particular blogpost. Is this not the right way of looking for those counts?
Or is there a setting within Sitefinity dashboard that I need to turn on/off to make the counts work?